https://github.com/francisrstokes/hindley-milner-parser
A Hindley-Milner type signature parser in haskell
https://github.com/francisrstokes/hindley-milner-parser
haskell parsec parser parser-combinators
Last synced: over 1 year ago
JSON representation
A Hindley-Milner type signature parser in haskell
- Host: GitHub
- URL: https://github.com/francisrstokes/hindley-milner-parser
- Owner: francisrstokes
- License: mit
- Created: 2018-12-10T14:14:02.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-12-11T09:42:38.000Z (over 7 years ago)
- Last Synced: 2025-02-09T13:11:14.504Z (over 1 year ago)
- Topics: haskell, parsec, parser, parser-combinators
- Language: Haskell
- Size: 3.91 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Hindley-Milner Type Signature Parser
This module lets you convert a Hindley-Milner type signature string like `traverse :: (Applicative f, Traversable t) => (a -> f b) -> t a -> f (t b)` to a typed `Either Error 3-tuple` representing the structure that looks like:
```
Right ( "traverse"
, TClassConstraints [ TClassConstraint ( "Applicative"
, "f" )
, TClassConstraint ( "Traversable"
, "t" ) ]
, TExpressions [ TBracketed ( TExpressions [ TIdentifier "a"
, TNestedType [ TIdentifier "f"
, TIdentifier "b" ] ] )
, TNestedType [ TIdentifier "t"
, TIdentifier "a" ]
, TNestedType [ TIdentifier "f"
, TBracketed ( TNestedType [ TIdentifier "t"
, TIdentifier "b" ] ) ] ] )
```
Where the first element of the tuple is the expression name, the second is the type class constraints, and the third is a tree representing the type expression.