{-# LANGUAGE Rank2Types #-} module Language.LOL.Symantic.Raw where import Data.Text (Text) import qualified Data.Text as Text -- * Type 'Raw' -- | Data type on the wire. data Raw = Raw Text [Raw] deriving (Eq, Show) read_safe :: Read a => Text -> Either Error_Read a read_safe t = case reads $ Text.unpack t of [(x, "")] -> Right x _ -> Left $ Error_Read t -- * Type 'Error_Read' data Error_Read = Error_Read Text deriving (Eq, Show)