Safe Haskell | None |
---|---|
Language | Haskell2010 |
- parseString :: String -> ParseResult
- parseText :: Text -> ParseResult
- parseFile :: FilePath -> IO ParseResult
- toSmaoinValue :: String -> Resource -> Either String Value
- toSmaoinModel :: Document -> ([Statement], [Statement], [Statement], [Statement], [Statement])
Documentation
parseString :: String -> ParseResult Source
Parse Kort source text from a String
.
parseText :: Text -> ParseResult Source
Parse Kort source text from Text
.
parseFile :: FilePath -> IO ParseResult Source
Parse Kort source text read from a file.
toSmaoinValue :: String -> Resource -> Either String Value Source
Parse a Kort literal into a typed value. Return an error message if the literal body format doesn't match the type.
toSmaoinModel :: Document -> ([Statement], [Statement], [Statement], [Statement], [Statement]) Source
Convert from the Kort document model to a list of Smaoin statements.
This function doesn't handle Uid generation or other shortcuts. It just collects statements invalid for Smaoin and statements with generators into separate lists. If you want Uids to be generated, use the functions in Language.Kort.UidGen.
5 lists are returned:
- Kort statements which don't have exactly 2 elements
- Kort statements with 2 elements, but containing generators
- Kort statements with 2 elements, but the 1st is a value, not a resource
- Kort statement with 2 elements, but invalid object value
- Successfully converted Smaoin statements
Kort comments are ignored and dropped.