This is specifically for handling the types that appear in
documentation generated by elm-make
. If you are looking to parse
arbitrary type signatures with creative indentation (e.g. newlines
and comments) this library will not do what you want. Instead,
check out the source code and go from there. It's not too tough!
Represent Elm types as values! Here are some examples:
Int ==> Type "Int" []
a -> b ==> Lambda (Var "a") (Var "b")
( a, b ) ==> Tuple [ Var "a", Var "b" ]
Maybe a ==> Type "Maybe" [ Var "a" ]
{ x : Int } ==> Record [("x", Type "Int" [])] Nothing
{ r | x : a } ==> Record [("x", Var "a")] (Just "r")
decoder : Json.Decode.Decoder Type
Decode the JSON representation of Type
values.