{"id":20042694,"url":"https://github.com/webcpu/haskellswift","last_synced_at":"2026-05-15T05:32:50.204Z","repository":{"id":63923362,"uuid":"97340965","full_name":"webcpu/HaskellSwift","owner":"webcpu","description":"A functional library for Swift programmers","archived":false,"fork":false,"pushed_at":"2019-11-13T15:57:56.000Z","size":10041,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-13T20:47:15.985Z","etag":null,"topics":["functional-programming","haskell","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","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/webcpu.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}},"created_at":"2017-07-15T20:34:57.000Z","updated_at":"2019-11-13T15:04:56.000Z","dependencies_parsed_at":"2023-01-14T14:30:26.867Z","dependency_job_id":null,"html_url":"https://github.com/webcpu/HaskellSwift","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webcpu%2FHaskellSwift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webcpu%2FHaskellSwift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webcpu%2FHaskellSwift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webcpu%2FHaskellSwift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webcpu","download_url":"https://codeload.github.com/webcpu/HaskellSwift/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241470709,"owners_count":19968091,"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":["functional-programming","haskell","swift"],"created_at":"2024-11-13T10:52:51.739Z","updated_at":"2026-05-15T05:32:48.575Z","avatar_url":"https://github.com/webcpu.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HaskellSwift\nA functional library for Swift programmers.\n\nIt contains a collection of useful functional libraries.\n### Data\nData.Char, Data.List, Data.Maybe, Data.Either, Data.Tuple, Data.Function\n\n### GHC\nData.Num\n\n### Language\nPrelude\n\n# Prerequisites\nmacOS 10.13\nXcode 9+\n\n# Examples\n## Data.List\n### map\n```\nlet xs = \"haskell\"\nmap(toUpper, xs)\n```\n`\"HASKELL\"`\n\n### filter\n```\nlet xs               = [1, 2, 3, 4, 5]\nlet greaterThanThree = { x in x \u003e 3 }\nfilter(greaterThanThree, list)\n```\n`[4, 5]`\n\n### foldl\n```\nlet xs       = [1, 2, 3]\nlet adds     = { (x: Int,y: Int) in x+y }\nfoldl1(adds, xs)\n```\n`6`\n\n## Data.Function\n### .. (Function Composition)\n#### 1\n```\nlet process : ([Int]) -\u003e Int = last .. reverse\nlet xs       = [1,2,3,4,5]\nprocess(xs)\n```\n`1`\n#### 2\n```\nfunc _isPrime(n : Int) -\u003e Bool {\n    let array2ToN : Int-\u003e[Int]   = { x in Array(2...x) }\n    let divisors  : Int-\u003e[Int]   = array2ToN .. Int.init .. ceil .. sqrt .. Double.init\n    let isDivisible              = or .. map({ x in n % x == 0})\n    let isNotPrime               = isDivisible .. divisors\n    return !isNotPrime(n)\n}\n_isPrime(3)\n```\n`true`\n\n## Data.Maybe\n### maybeToList\n```\nlet x : Int? = nil\nmaybeToList(x)\n```\n`[]`\n\n### catMaybes\n```\nlet xs: [Int?] = [1, nil, 3]\ncatMaybes(xs)\n```\n`[1,3]`\n\n### How does it help?\nThere are 3 solutions to the same problem. A, B, C\n\u003cimg width=\"892\" alt=\"screenshot 2016-03-15 12 02 15\" src=\"https://user-images.githubusercontent.com/4646838/32611428-f51b9eaa-c565-11e7-96ea-8a365e92946a.png\"\u003e\n \nA doesn't use HaskellSwift, B and C use HaskellSwift.\nA is imperative, B and C are declarative.\n\nIf you want to know more about it, please check the test cases in the Xcode Project or use Hoogle.\n\nhttps://www.haskell.org/hoogle/?hoogle=map\n\nIn addition, there is a public project which is written in HaskellSwift.\n\nhttps://github.com/unchartedworks/autobuild\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebcpu%2Fhaskellswift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebcpu%2Fhaskellswift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebcpu%2Fhaskellswift/lists"}