X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Flib%2Fstd%2FPrelRead.lhs;h=ad3fe8161c577fe8b228b535b5c4b57a03aa087f;hb=e921b2e307532e0f30eefa88b11a124be592bde4;hp=596b0c75a8148f269e488068455a0904b36ccbdf;hpb=c415cd35368f45739132fc180837fc07f0490921;p=ghc-hetmet.git diff --git a/ghc/lib/std/PrelRead.lhs b/ghc/lib/std/PrelRead.lhs index 596b0c7..ad3fe81 100644 --- a/ghc/lib/std/PrelRead.lhs +++ b/ghc/lib/std/PrelRead.lhs @@ -14,7 +14,8 @@ module PrelRead where import PrelErr ( error ) import PrelEnum ( Enum(..) ) import PrelNum -import PrelNumExtra +import PrelReal +import PrelFloat import PrelList import PrelTup import PrelMaybe @@ -22,8 +23,8 @@ import PrelShow -- isAlpha etc import PrelBase import Monad --- needed for readIO. -import PrelIOBase ( IO, userError ) +-- needed for readIO and instance Read Buffermode +import PrelIOBase ( IO, userError, BufferMode(..) ) import PrelException ( ioError ) \end{code} @@ -604,3 +605,26 @@ readRational__ top_s #endif \end{code} + +%********************************************************* +%* * +\subsection{Reading BufferMode} +%* * +%********************************************************* + +This instance decl is here rather than somewhere more appropriate in +order that we can avoid both orphan-instance modules and recursive +dependencies. + +\begin{code} +instance Read BufferMode where + readsPrec _ = + readParen False + (\r -> let lr = lex r + in + [(NoBuffering, rest) | ("NoBuffering", rest) <- lr] ++ + [(LineBuffering,rest) | ("LineBuffering",rest) <- lr] ++ + [(BlockBuffering mb,rest2) | ("BlockBuffering",rest1) <- lr, + (mb, rest2) <- reads rest1]) + +\end{code}