Commit Graph

33 Commits

Author SHA1 Message Date
Ari Fordsham
ed520491d4 Complete GHC 9 support and CI 2021-08-12 13:23:54 +01:00
Sreenidhi
f4476d9e61 Add standaloneDeriving 2021-04-27 00:34:29 +05:30
Sandy Maguire
bb6061cef4
Add funBindsWithFixity (#79) 2021-04-18 11:06:50 -07:00
Jinwoo Lee
cf0bb23e53 Support list comprehensions.
Fixes #64.
2020-05-28 13:32:24 -07:00
Jinwoo Lee
6bc0965232 Support arithmetic sequences.
`from`      : [a .. ]
`fromThen`  : [a, b .. ]
`fromTo`    : [a .. b]
`fromThenTo`: [a, b .. c]

These are needed before supporting list comprehensions (#64).
2020-05-28 10:50:55 -07:00
ersran9
079fb254db
promoted tuples (#62)
Also adds an internal `withPlaceHolders` combinator.
2020-02-04 07:36:48 -08:00
Judah Jacobson
766dbae97c
Add kindedVar and take type parameters as HsTyVarBndr'. (#61)
Previously functions like `class'` and `data'` took their
type variables as `OccNameStr` which let them be passed
as overloaded strings; for example, `data' "Maybe" ["a"] ...`.
Now, they take them as `HsTyVarBndr'`, the same as `forall'`,
and can be constructed with, for example,
`data' "Maybe" [bvar "a"] ...`.

This approach lets them be constructed with either `bvar` (for regular
variables) or `kindedVar` (for kind signatures).

Original patch by ersran9@.
2020-02-03 08:23:30 -08:00
Judah Jacobson
76214aa98f
Support {-# SOURCE #-} imports. (#58)
Also adds a unit test for this feature, and a TODO to add more tests
of `module'` and `import'`.
2020-01-03 11:20:50 -08:00
Judah Jacobson
cf6eb5e260
Fix listPromotedTy on lists of one or zero elements. (#55)
We need the explicit `'` to distinguish from regular lists.
For simplicity, just use it for all type-level lists of
any length.
2019-10-17 11:01:35 -07:00
Judah Jacobson
5986388e5b
Add occNameToStr and nameToStr to convert from the GHC types. (#54)
Previously it was cumbersome to create an `OccNameStr` from an
`OccName` or a `Name`.

Fixes #53.
2019-09-02 23:18:06 -07:00
Judah Jacobson
1d350f8eaa
Various cleanups (#48) 2019-08-31 16:32:28 -07:00
Judah Jacobson
316e9c28bc
Use the BVar class for patterns and type variable bindings. (#46)
Also make data/newtype declaration type parameters be OccNameStr.
2019-08-31 10:38:36 -07:00
Judah Jacobson
18f8e8d2c2
Make tyPromotedVar pretty-print as 'Abc not Abc. (#44)
Also make it possible for unit tests to change behavior based on the
version of GHC.
2019-08-30 21:32:01 -07:00
Judah Jacobson
bed038cd28
Implement basic prefix pattern synonyms. (#43)
Progress on #28.  Still need several variants such as unidirectional,
explicit bididirectonal, records, and infix operators.
2019-08-30 20:40:17 -07:00
Judah Jacobson
b15ba9fbcf
Fix pretty-printing of rational literals. (#42)
Print them in double syntax, just like they're parsed.
Fixes #33.
2019-08-30 20:27:58 -07:00
Judah Jacobson
bfd43916b5
Make tyApp's precedence match -XTypeApplications. (#41)
The precedence with which GHC parses `@` in expressions changes
depending on whether `-XTypeApplications` is set.

In particular, `(var "f" @@ var "x") `tyApp` var "t"` should
render to `"f x @t"`.
2019-08-25 15:24:09 -07:00
Judah Jacobson
3af6da1152
Fix parentheses for tyApp. (#40) 2019-08-25 14:32:00 -07:00
Judah Jacobson
0b726749a2
Make ==> have the same precedence as --> (#39) 2019-08-25 13:24:27 -07:00
Judah Jacobson
15df48689e
Parenthesize let-expressions inside of do-expressions. (#38)
The following syntax is not valid, but can be generated by GHC;

```
do let ...
   in ...
```

It's not always a problem, if GHC manages to wrap it like

```
do let ... in ...
```

But for consistency, and since this ought to be an uncommon case,
always wrap `let`s in parentheses when they're inside of a `do` statement.
2019-08-25 10:26:40 -07:00
Judah Jacobson
b2a6ff551b
Parenthesize patterns in bindings on older GHC. (#37) 2019-08-25 10:05:49 -07:00
Judah Jacobson
92fad84066
Unit tests for recordConP (#36) 2019-08-25 09:47:19 -07:00
Judah Jacobson
3db45a3f33
sigP. Needs tests and thinking about parens. (#35) 2019-08-25 09:13:59 -07:00
Judah Jacobson
a792e98f49
Add parentheses in more cases. (#34)
- Op applied to argument
- patterns (for older GHCs)
2019-08-25 08:43:47 -07:00
Judah Jacobson
18d1ca0338
Fix edge cases parsing qualified operators. (#32)
Also add some tests, and expose more functionality to work with names.
2019-08-18 15:03:45 -07:00
Judah Jacobson
362eadc898
Replace matchRhs/matchRhs with match/matchGRHSs. (#26)
Optimize names for the common case taking just an expression
on the RHS.

Also for `valBind` and `patBind`.
2019-08-17 22:21:24 -07:00
Judah Jacobson
2cceb66969
Introduce valBind, and add HasPatBind. (#25)
Another follow-up fix for #13:
- Don't allow pattern bindings in class or instance declarations
- Add `valBind` which *is* allowed in let and where clauses
- Add `valBindRhs` and `patBindRhs`.
2019-08-17 21:31:42 -07:00
Judah Jacobson
4a703f9468
Implement type family instances. (#23) 2019-08-11 09:33:24 -07:00
Judah Jacobson
14ecaf64df
Add record expressions and patterns. (#21) 2019-08-04 18:25:10 -07:00
Judah Jacobson
aaf1a43b9d
Construction of import/export items. (#20) 2019-07-28 20:29:26 -07:00
Judah Jacobson
f1e93651c9
Deriving clauses. (#17)
For now, no DerivingVia since it's not in every GHC version.
2019-07-28 18:04:59 -07:00
Judah Jacobson
5b02f333db
Rename guarded to guardedRhs. (#7) 2019-07-14 06:56:18 -07:00
Judah Jacobson
f0388f4748
Refactor matches/bindings to support patBind. (#6) 2019-07-14 06:40:18 -07:00
Judah Jacobson
1346ef0ca8 Initial commit. 2019-07-09 13:58:46 -07:00