]> Git — Sourcephile - haskell/symantic.git/blob - Language/LOL/Symantic/Raw.hs
init
[haskell/symantic.git] / Language / LOL / Symantic / Raw.hs
1 {-# LANGUAGE Rank2Types #-}
2 module Language.LOL.Symantic.Raw where
3
4 import Data.Text (Text)
5 import qualified Data.Text as Text
6
7 -- * Type 'Raw'
8
9 -- | Data type on the wire.
10 data Raw
11 = Raw Text [Raw]
12 deriving (Eq, Show)
13
14 read_safe :: Read a => Text -> Either Error_Read a
15 read_safe t =
16 case reads $ Text.unpack t of
17 [(x, "")] -> Right x
18 _ -> Left $ Error_Read t
19
20 -- * Type 'Error_Read'
21
22 data Error_Read
23 = Error_Read Text
24 deriving (Eq, Show)