on master help sign in
Add Read instances for Color, MaybeDefault, and Attr
commitb130a2b74036b66fef866eaf62d4841478f71317 authorJonathan Daugherty <cygnus@foobox.com> dateSat 18 Jul 2015, 18:56 (11 years ago) parent6e2a7ad
2 files changed+4−3
src/Graphics/Vty/Attributes.hs+3−2 src/Graphics/Vty/Attributes/Color.hs+1−1
src/Graphics/Vty/Attributes.hs+3−2
@@ -49,7 +49,7 @@ data Attr = Attr
4949 { attrStyle :: !(MaybeDefault Style)
5050 , attrForeColor :: !(MaybeDefault Color)
5151 , attrBackColor :: !(MaybeDefault Color)
52− } deriving ( Eq, Show )
52+ } deriving ( Eq, Show, Read )
5353
5454-- This could be encoded into a single 32 bit word. The 32 bit word is first divided
5555-- into 4 groups of 8 bits where: The first group codes what action should be taken with regards to
@@ -103,10 +103,11 @@ data FixedAttr = FixedAttr
103103data MaybeDefault v where
104104 Default :: MaybeDefault v
105105 KeepCurrent :: MaybeDefault v
106− SetTo :: forall v . ( Eq v, Show v ) => !v -> MaybeDefault v
106+ SetTo :: forall v . ( Eq v, Show v, Read v ) => !v -> MaybeDefault v
107107
108108deriving instance Eq v => Eq (MaybeDefault v)
109109deriving instance Eq v => Show (MaybeDefault v)
110+deriving instance (Eq v, Show v, Read v) => Read (MaybeDefault v)
110111
111112instance Eq v => Monoid ( MaybeDefault v ) where
112113 mempty = KeepCurrent
src/Graphics/Vty/Attributes/Color.hs+1−1
@@ -47,5 +47,5 @@ import Data.Word
4747--
4848-- Seriously, terminal color support is INSANE.
4949data Color = ISOColor !Word8 | Color240 !Word8
50− deriving ( Eq, Show )
50+ deriving ( Eq, Show, Read )
5151