From: sof Date: Mon, 24 Nov 1997 20:40:59 +0000 (+0000) Subject: [project @ 1997-11-24 20:40:59 by sof] X-Git-Tag: Approx_2487_patches~1263 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=8160d55ca73a164aed9540d82ac977c1b7bcd092;p=ghc-hetmet.git [project @ 1997-11-24 20:40:59 by sof] Added Read BufferMode instance --- diff --git a/ghc/lib/required/IO.lhs b/ghc/lib/required/IO.lhs index 4e058d3..6234592 100644 --- a/ghc/lib/required/IO.lhs +++ b/ghc/lib/required/IO.lhs @@ -40,6 +40,7 @@ import ArrBase ( MutableByteArray(..), newCharArray ) import IOHandle -- much of the real stuff is in here import PackBase ( unpackNBytesST ) import PrelBase +import PrelRead ( readParen, Read(..), reads, lex ) import PrelMaybe import PrelEither import GHC @@ -129,6 +130,18 @@ instance Show Handle where {showsPrec p h = showString "<>"} instance Eq HandlePosn where (HandlePosn h1 p1) == (HandlePosn h2 p2) = p1==p2 && h1==h2 +-- Type declared in IOBase, instance here because it +-- depends on PrelRead.(Read Maybe) instance. +instance Read BufferMode where + readsPrec p = + 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} %*********************************************************