Commit 385055c0 authored by ian@well-typed.com's avatar ian@well-typed.com

Beautify a few Binary instances

parent fb520bb6
......@@ -56,6 +56,7 @@ import TysWiredIn ( eqTyConName )
import Fingerprint
import Binary
import Control.Monad
import System.IO.Unsafe
infixl 3 &&&
......@@ -312,10 +313,10 @@ instance Binary IfaceConDecls where
get bh = do
h <- getByte bh
case h of
0 -> get bh >>= (return . IfAbstractTyCon)
0 -> liftM IfAbstractTyCon $ get bh
1 -> return IfDataFamTyCon
2 -> get bh >>= (return . IfDataTyCon)
_ -> get bh >>= (return . IfNewTyCon)
2 -> liftM IfDataTyCon $ get bh
_ -> liftM IfNewTyCon $ get bh
visibleIfConDecls :: IfaceConDecls -> [IfaceConDecl]
visibleIfConDecls (IfAbstractTyCon {}) = []
......@@ -512,7 +513,7 @@ instance Binary IfaceIdInfo where
h <- getByte bh
case h of
0 -> return NoInfo
_ -> lazyGet bh >>= (return . HasInfo) -- NB lazyGet
_ -> liftM HasInfo $ lazyGet bh -- NB lazyGet
-- Here's a tricky case:
-- * Compile with -O module A, and B which imports A.f
......@@ -541,12 +542,12 @@ instance Binary IfaceInfoItem where
get bh = do
h <- getByte bh
case h of
0 -> get bh >>= (return . HsArity)
1 -> get bh >>= (return . HsStrictness)
0 -> liftM HsArity $ get bh
1 -> liftM HsStrictness $ get bh
2 -> do lb <- get bh
ad <- get bh
return (HsUnfold lb ad)
3 -> get bh >>= (return . HsInline)
3 -> liftM HsInline $ get bh
_ -> return HsNoCafRefs
-- NB: Specialisations and rules come in separately and are
......@@ -777,8 +778,8 @@ instance Binary IfaceConAlt where
h <- getByte bh
case h of
0 -> return IfaceDefault
1 -> get bh >>= (return . IfaceDataAlt)
_ -> get bh >>= (return . IfaceLitAlt)
1 -> liftM IfaceDataAlt $ get bh
_ -> liftM IfaceLitAlt $ get bh
data IfaceBinding
= IfaceNonRec IfaceLetBndr IfaceExpr
......
......@@ -24,6 +24,7 @@ import Serialized
import UniqFM
import Unique
import Control.Monad
import Data.Maybe
import Data.Typeable
import Data.Word ( Word8 )
......@@ -75,8 +76,8 @@ instance Binary name => Binary (AnnTarget name) where
get bh = do
h <- getByte bh
case h of
0 -> get bh >>= (return . NamedTarget)
_ -> get bh >>= (return . ModuleTarget)
0 -> liftM NamedTarget $ get bh
_ -> liftM ModuleTarget $ get bh
instance Outputable Annotation where
ppr ann = ppr (ann_target ann)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment