on master help sign in
remove data type context usage. Use GADTs.
b252930Corey O'Connor
src/Graphics/Vty/Attributes.hs+10−2
@@ -1,3 +1,6 @@
1+{-# LANGUAGE StandaloneDeriving #-}
2+{-# LANGUAGE GADTs #-}
3+{-# LANGUAGE RankNTypes #-}
1-- Copyright 2009-2010 Corey O'Connor
4-- Copyright 2009-2010 Corey O'Connor
2-- Display attributes
5-- Display attributes
3--
6--
@@ -69,8 +72,13 @@ data FixedAttr = FixedAttr
69
72
70-- | The style and color attributes can either be the terminal defaults. Or be equivalent to the
73-- | The style and color attributes can either be the terminal defaults. Or be equivalent to the
71-- previously applied style. Or be a specific value.
74-- previously applied style. Or be a specific value.
72−data Eq v => MaybeDefault v = Default | KeepCurrent | SetTo !v
75+data MaybeDefault v where
73− deriving ( Eq, Show )
76+ Default :: MaybeDefault v
77+ KeepCurrent :: MaybeDefault v
78+ SetTo :: forall v . ( Eq v, Show v ) => !v -> MaybeDefault v
79+
80+deriving instance Eq v => Eq (MaybeDefault v)
81+deriving instance Eq v => Show (MaybeDefault v)
74
82
75instance Eq v => Monoid ( MaybeDefault v ) where
83instance Eq v => Monoid ( MaybeDefault v ) where
76 mempty = KeepCurrent
84 mempty = KeepCurrent