Skip to content

Latest commit

 

History

History
10 lines (9 loc) · 438 Bytes

File metadata and controls

10 lines (9 loc) · 438 Bytes

Validation (Type Checking)

validate ::  TypeEnv -> Map ALocation Literal -> ALocation -> TypeExp -> Except String ()
parsePrim :: String -> Primitive -> Except String Literal
parsePrim "hoge" PString `shouldBe` pure (LString "hoge")
parsePrim "1.0" PNumber `shouldBe` pure (LNumber 1.0)
parsePrim "42" PInt `shouldBe` pure (LNumber 42.0)
parsePrim "hoge" PNumber `shouldBe` throwError "cannot parse \"hoge\" as a number"