Skip to content

Commit

Permalink
Make parsing of varsig more flexible
Browse files Browse the repository at this point in the history
  • Loading branch information
Vilem Liepelt committed Mar 1, 2019
1 parent fc160dc commit 75b8da0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions frontend/src/Language/Granule/Syntax/Parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -260,13 +260,13 @@ TypeScheme :: { TypeScheme }
{% (mkSpan (fst $ fst $1)) >>= \sp -> return $ Forall sp (snd $ fst $1) (snd $1) $2 }

VarSigs :: { [(Id, Kind)] }
: VarSig ',' VarSigs { $1 : $3 }
| VarSig { [$1] }

VarSig :: { (Id, Kind) }
: VAR ':' Kind { (mkId $ symString $1, $3) }
| VAR { (mkId $ symString $1, KType) }-- KVar $ mkId ("k" <> symString $1))}
: VarSig ',' VarSigs { $1 <> $3 }
| VarSig { $1 }

VarSig :: { [(Id, Kind)] }
: VAR ':' Kind { [(mkId $ symString $1, $3)] }
| VAR { [(mkId $ symString $1, KType)] }-- KVar $ mkId ("k" <> symString $1))}
| VAR VarSig { (mkId $ symString $1, snd . head $ $2) : $2 }

Kind :: { Kind }
: Kind '->' Kind { KFun $1 $3 }
Expand Down

0 comments on commit 75b8da0

Please sign in to comment.