1{-# OPTIONS_GHC -Wall #-}
2module Transform.Definition where
4import Control.Applicative ((<$>))
5import qualified SourceSyntax.Pattern as P
6import SourceSyntax.Expression
7import qualified Transform.Expression as Expr
9combineAnnotations :: [ParseDef] -> Either String [Def]
10combineAnnotations = go
12 msg x = "Syntax Error: The type annotation for '" ++ x ++
13 "' must be directly above its definition."
17 TypeAnnotation name tipe : Def pat@(P.PVar name') expr : rest | name == name' ->
18 do expr' <- Expr.crawl combineAnnotations expr
19 let def = Definition pat expr' (Just tipe)
22 TypeAnnotation name _ : _ -> Left (msg name)
24 Def pat expr : rest ->
25 do expr' <- Expr.crawl combineAnnotations expr
26 let def = Definition pat expr' Nothing
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list