{"id":17432028,"url":"https://github.com/rayshih/purescript-learning","last_synced_at":"2026-01-06T23:08:54.476Z","repository":{"id":146928953,"uuid":"86963152","full_name":"rayshih/purescript-learning","owner":"rayshih","description":null,"archived":false,"fork":false,"pushed_at":"2017-05-25T03:03:55.000Z","size":42,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-02T02:45:47.794Z","etag":null,"topics":["learning-notes","purescript"],"latest_commit_sha":null,"homepage":null,"language":"PureScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rayshih.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-04-02T04:34:27.000Z","updated_at":"2018-04-02T04:59:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"66805d02-7452-4965-800d-864efd311472","html_url":"https://github.com/rayshih/purescript-learning","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rayshih%2Fpurescript-learning","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rayshih%2Fpurescript-learning/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rayshih%2Fpurescript-learning/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rayshih%2Fpurescript-learning/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rayshih","download_url":"https://codeload.github.com/rayshih/purescript-learning/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245949603,"owners_count":20698922,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["learning-notes","purescript"],"created_at":"2024-10-17T08:09:48.621Z","updated_at":"2026-01-06T23:08:54.436Z","avatar_url":"https://github.com/rayshih.png","language":"PureScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# My Purescript Learning Notes\n\nThis a repo that record my learning process of learning purescript.\n\nI created this repo to share my learning experience of purescript.\nHope I can help more and more people get into the beauty of functional programming.\n\nWelcome to leave any things as issues, like any parts that you don't understand or any suggestions.\n\nI mean ANYTHING!\n\n## Some notices before start\n\nI'm trying to target the very newcomers, like someone doesn't have any programming experience.\nSo if there are some things need more advanced knowledge, I'll simply mark them as \"medium\" or\n\"advanced\" and won't describe the detail, and then carry on.\n\n## Current: Lession 1 - Hello World\n\nLet's start with web app!\n\nThere are several frameworks can be used, and I think the most easier one to start with is Pux.\n\nHere is the official Pux website: \u003chttp://purescript-pux.org/\u003e\n\nLet's start!\n\n### Step 1:\n\nInstall npm, git.\n\nNpm is the tool related to JavaScript environment. And Git is a tool for version control.\nWe don't need to learn the details of them for now.\n\n### Step 2:\n\nClone the starter project:\n\n```bash\n// Open your terminal and type following commands\n\n// Just clone a template project into folder `1-pux-hello-world`\ngit clone git://github.com/alexmingoia/pux-starter-app.git 1-pux-hello-world\n\n// Change directory into this folder\ncd 1-pux-hello-world\n\n// Install the dependencies\nnpm install\n\n// Run the project\nnpm start\n```\n\nAnd then, give it a little time until it shows\n\n```\nListening on 3000\n```\n\nThen you can open your browser and type `localhost:3000` to see the web app you just created.\n\n### Step 3: The Hello World\n\nThere are lots of files created which seems a little bit scary. But please don't.\nLet's write our first line of code!\n\nOpen the file `src/App/View/Homepage.purs` with any text editor you like.\nYou will see bunch of `import`s, but you can ignore it for now.\n\nFollow that, there are 4 lines:\n\n```purescript\nview :: State -\u003e HTML Event\nview (State st) =\n  div do\n    h1 $ a ! href \"https://www.purescript-pux.org\" $ text \"purescript-pux.org\"\n```\n\nPlease do not try to understand them for now. I'll explain later.\nFor the \"Hello World\", please replace the last 3 lines like this.\n\n```purescript\nview :: State -\u003e HTML Event\nview _ = text \"Hello World\"\n```\n\nRemember to save your file, and go back to your browser and witness the change you just made.\n(Don't need to refresh the page)\n\nYou may see few warnings appear in your terminal. Don't worry, We'll clean them later.\n\n### Explain a little bit\n\nFirst of all, `--` means comment in purescript.\n\n```purescript\n-- The type annotation, we will talk this later\nview :: State -\u003e HTML Event\n\n-- The function to render the view,\n-- there is only one thing be rendered: text\nview _ = text \"Hello World\"\n```\n\nThe String:\n\nIn any programming language, any value have type, like: String, Number.\nAnd in order to identify whether a value is a string, we use double quotes.\nThe `\"Hello World\"` is the example we have here.\n\nWhat is the `text` here?\n\n`text` is a function which take one string and return a view.\n\nThere are two parts of function:\n\n1. Function definition\n2. Function invocation\n\nThe `f(x) = x + 1` is the way we defined function in the school.\nIn PureScript, it is almost the same. Just remove the parenthesis.\nLike: `f x = x + 1`\n\nAnd the corresponding invocation: `f(3)`, which will give us `4`.\nIn PureScript, we'll get the function by removing the parenthesis.\nLike: `f 3`\n\nSo in our first program:\n\n`view` is the function we defined, there is only one parameter,\nand we actually didn't use it at all. So we just place the underscore here to tell\nthe computer we don't care about the input\n\nAnd the `text \"Hello World\"` is the funciton invocation.\n\nEnd of Lession 1\n\n## Next things to learn\n\n- Server side programming\n\n## More Learning Materials\n\nHere are some reading materials that I've read before start this repository.\n\n1. [PureScript by Example](https://leanpub.com/purescript/read)\n2. [Learn you a Haskell](http://learnyouahaskell.com/)\n\nHowever, it's not necessary to read these before checking this repo.\nI'll try my best to describe any detail, and hope that it is extrememly easy to\nunderstand, even for the person who haven't done any programming before.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frayshih%2Fpurescript-learning","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frayshih%2Fpurescript-learning","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frayshih%2Fpurescript-learning/lists"}