3import Control.Applicative ((<$>),(<*>))
4import Control.Monad (liftM,mapM)
5import Data.Char (isLower)
6import Data.List (lookup,intercalate)
8import Text.Parsec.Indent
10import SourceSyntax.Type as T
15tvar = T.Var <$> lowVar <?> "type variable"
18list = listOf <$> braces expr
20tuple :: IParser T.Type
21tuple = do ts <- parens (commaSep expr)
26record :: IParser T.Type
28 do char '{' ; whitespace
31 dumbWhitespace ; char '}'
32 return (T.Record (fieldMap fs) ext)
34 extend = option T.EmptyRecord . try $ do
36 whitespace >> string "|" >> whitespace
38 fields = commaSep $ do
40 whitespace >> hasType >> whitespace
43capTypeVar = intercalate "." <$> dotSep1 capVar
45constructor0 :: IParser T.Type
48 return (T.Data name [])
51term = list <|> tuple <|> record <|> tvar <|> constructor0
55 do name <- capTypeVar <|> try tupleCtor <?> "type constructor"
56 args <- spacePrefix term
57 return (T.Data name args)
60 n <- length <$> parens (many (char ','))
61 return $ "_Tuple" ++ show (if n == 0 then 0 else n+1)
67 arr <- optionMaybe arrow
70 Just _ -> T.Lambda t1 <$> expr
73constructor :: IParser (String, [T.Type])
74constructor = (,) <$> (capTypeVar <?> "another type constructor")
77readType :: String -> Type
79 case iParse expr "" str of
80 Left err -> error (show err)
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