module Text.Read ( Read(..), ReadS, reads, read, readParen, lex, #if defined(__GLASGOW_HASKELL__) || defined(__HUGS__) module Text.ParserCombinators.ReadPrec, L.Lexeme(..), lexP, parens, #endif #ifdef __GLASGOW_HASKELL__ readListDefault, readListPrecDefault, #endif ) where #ifdef __GLASGOW_HASKELL__ import GHC.Base import GHC.Read import Data.Either import Text.ParserCombinators.ReadP as P #endif #if defined(__GLASGOW_HASKELL__) || defined(__HUGS__) import Text.ParserCombinators.ReadPrec import qualified Text.Read.Lex as L #endif #ifdef __HUGS__ lexP :: ReadPrec L.Lexeme lexP = lift L.lex parens :: ReadPrec a -> ReadPrec a parens p = optional where optional = p +++ mandatory mandatory = do L.Punc "(" <- lexP x <- reset optional L.Punc ")" <- lexP return x #endif #ifdef __GLASGOW_HASKELL__ reads :: Read a => ReadS a reads = readsPrec minPrec readEither :: Read a => String -> Either String a readEither s = case [ x | (x,"") <- readPrec_to_S read' minPrec s ] of [x] -> Right x [] -> Left "Prelude.read: no parse" _ -> Left "Prelude.read: ambiguous parse" where read' = do x <- readPrec lift P.skipSpaces return x read :: Read a => String -> a read s = either error id (readEither s) #endif
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4