{"id":23655757,"url":"https://github.com/lue-bird/elm-syntax-to-fsharp","last_synced_at":"2025-04-10T14:04:52.600Z","repository":{"id":270090342,"uuid":"909310518","full_name":"lue-bird/elm-syntax-to-fsharp","owner":"lue-bird","description":"transpile elm to F#","archived":false,"fork":false,"pushed_at":"2025-01-16T14:37:04.000Z","size":51,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-05T00:11:31.438Z","etag":null,"topics":["elm","fsharp","transpiler"],"latest_commit_sha":null,"homepage":"","language":"Elm","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/lue-bird.png","metadata":{"files":{"readme":"README.md","changelog":"changes.md","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":"2024-12-28T10:17:59.000Z","updated_at":"2025-01-22T17:20:03.000Z","dependencies_parsed_at":"2024-12-28T11:21:34.843Z","dependency_job_id":"007b9ad2-f363-4a4c-a2f7-3e377e7437c1","html_url":"https://github.com/lue-bird/elm-syntax-to-fsharp","commit_stats":null,"previous_names":["lue-bird/elm-syntax-to-fsharp"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lue-bird%2Felm-syntax-to-fsharp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lue-bird%2Felm-syntax-to-fsharp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lue-bird%2Felm-syntax-to-fsharp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lue-bird%2Felm-syntax-to-fsharp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lue-bird","download_url":"https://codeload.github.com/lue-bird/elm-syntax-to-fsharp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248231499,"owners_count":21069340,"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":["elm","fsharp","transpiler"],"created_at":"2024-12-28T20:15:39.494Z","updated_at":"2025-04-10T14:04:52.578Z","avatar_url":"https://github.com/lue-bird.png","language":"Elm","funding_links":[],"categories":[],"sub_categories":[],"readme":"Print pure [`elm-syntax`](https://dark.elm.dmy.fr/packages/stil4m/elm-syntax/latest/) declarations as\n[F#](https://fsharp.org/) code.\n\nWhile that might already be useful on its own (wasm target etc),\nyou can even compile the generated F# further into rust etc using [fable](https://fable.io/).\n\n```elm\nimport Elm.Parser\nimport ElmSyntaxToFsharp\n\n\"\"\"module Sample exposing (..)\n\nplus2 : Int -\u003e Int\nplus2 n =\n    n + ([ 2 ] |\u003e List.sum)\n\"\"\"\n    |\u003e Elm.Parser.parseToFile\n    |\u003e Result.mapError (\\_ -\u003e \"failed to parse elm source code\")\n    |\u003e Result.map\n        (\\syntaxModule -\u003e\n            [ syntaxModule ]\n                |\u003e ElmSyntaxToFsharp.modules\n                |\u003e .declarations\n                |\u003e ElmSyntaxToFsharp.fsharpDeclarationsToModuleString\n        )\n--\u003e\nOk \"\"\"namespace global\nmodule rec Elm =\n    let samplePlus2 : float -\u003e float =\n        fun n -\u003e\n            basics_add n (List.sum [ 2 ])\n\n    ..and some default declarations..\n\"\"\"\n```\n\nTo try it out, you can\nrun [this node script](https://github.com/lue-bird/elm-syntax-to-fsharp/tree/main/node-elm-to-fsharp).\n\n### be aware\n\n-   only a subset of elm is currently supported. not supported:\n    -   `elm/regex`, `elm/file`, `elm/bytes`, `elm/http`, `elm/random`, `elm/url`, `elm/json`, `elm/parser`, `elm/virtual-dom`,\n        `elm/html`, `elm/svg`, `elm/browser`, `elm/time`, `elm-explorations/markdown`, `elm-explorations/webgl`, `elm-explorations/benchmark`, `elm-explorations/linear-algebra`\n    -   `Platform`, `Platform.Cmd`, `Platform.Sub`, `Task`, `Process`\n    -   ports, glsl, the prefix operator functions `(\u003e\u003e)` and `(\u003c\u003c)`\n    -   `++` will default to `List.append` unless one of the arguments is a string literal. So e.g. use `a ++ b ++ \"\"` to append string variables (which is also faster in elm)\n    -   extensible record types. For example, these declarations won't work (at let or module level):\n        ```elm\n        -- inferred { r | name : name } -\u003e name\n        getName =\n            .name\n        \n        -- inferred name -\u003e { r | name : name } -\u003e { r | name : name }\n        setName new r =\n            { r | name = new }\n        \n        -- even if used in explicit annotation\n        getName : { r | name : name } -\u003e name\n        getName =\n            .name\n        \n        -- even if the extensible record type is \"fully constructed\"\n        type alias Named otherFields =\n            { otherFields | name : String }\n        \n        getName : Named { email : Email } -\u003e String\n        getName =\n            .name\n        ```\n        Allowed however are for example:\n        ```elm\n        type alias User =\n            { name : String, email : Email }\n        \n        userGetName : User -\u003e String\n        userGetName =\n            .name\n        ```\n        Incidentally, avoiding extensible record types\n        also tends to improve your elm code because it's simpler and makes the compiler errors more concrete\n    -   potential future candidates: `Basics.(\u003c\u003c)`, `Basics.(\u003e\u003e)`, `Basics.clamp`, `Basics.degrees`, `Basics.turns`,\n        `Basics.radians`, `Basics.logBase`, `Basics.atan2`, `Basics.toPolar`, `Basics.fromPolar`, `Basics.never`, `String.reverse`, `List.map5`, `List.map4`, `Char.toLocaleLower`, `Char.toLocaleUpper`, `Char.isAlpha`, `Char.isAlphaNum`, `Char.isDigit`, `Char.isOctDigit`, `Char.isHexDigit`, `List.head`, `List.tail`, `List.unzip`, `Dict.update`, `Dict.merge`, `Dict.intersect`, `Bitwise`, `Set`, `Array`. Any help appreciated!\n-   no checks are performed before transpiling to fsharp. So if you don't add a compile check of your elm input,\n    you might e.g. get a running program that circumvents an elm opaque type or phantom type, or a fsharp program that can't be run\n-   not much care has been put into making the resulting code readable or even conventionally formatted\n    and comments are not preserved\n\nPlease [report any issues](https://github.com/lue-bird/elm-syntax-to-fsharp/issues/new) you notice \u003c3\n\n### why F#?\n-   it runs decently fast and can directly target Wasm\n-   it's pretty much a superset of elm which makes transpiling easy\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flue-bird%2Felm-syntax-to-fsharp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flue-bird%2Felm-syntax-to-fsharp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flue-bird%2Felm-syntax-to-fsharp/lists"}