Change constraint synonym syntax from "constraint" to "type constraint".

For example:

type constraint NonZero n = (fin n, 1 <= n)

last : {n, a} NonZero n => [n]a -> a
last xs = xs!0
This commit is contained in:
Brian Huffman 2017-09-21 13:21:51 -07:00
parent 393a11e170
commit 2ce1ca3eca

View File

@ -298,10 +298,10 @@ decl :: { Decl PName }
| 'type' name tysyn_params '=' type | 'type' name tysyn_params '=' type
{% at ($1,$5) `fmap` mkTySyn $2 (reverse $3) $5 } {% at ($1,$5) `fmap` mkTySyn $2 (reverse $3) $5 }
| 'constraint' name '=' type | 'type' 'constraint' name '=' type
{% at ($1,$4) `fmap` mkPropSyn $2 [] $4 } {% at ($2,$5) `fmap` mkPropSyn $3 [] $5 }
| 'constraint' name tysyn_params '=' type | 'type' 'constraint' name tysyn_params '=' type
{% at ($1,$5) `fmap` mkPropSyn $2 (reverse $3) $5 } {% at ($2,$6) `fmap` mkPropSyn $3 (reverse $4) $6 }
| 'infixl' NUM ops {% mkFixity LeftAssoc $2 (reverse $3) } | 'infixl' NUM ops {% mkFixity LeftAssoc $2 (reverse $3) }
| 'infixr' NUM ops {% mkFixity RightAssoc $2 (reverse $3) } | 'infixr' NUM ops {% mkFixity RightAssoc $2 (reverse $3) }