on master help sign in
remove data type context usage. Use GADTs.
commitb252930bc0f66e44782f2d604d73133331fac457 authorCorey O'Connor <coreyoconnor@gmail.com> dateWed 2 Nov 2011, 16:53 (15 years ago) parentcaf9656
1 file changed+10−2
src/Graphics/Vty/Attributes.hs+10−2
src/Graphics/Vty/Attributes.hs+10−2
@@ -1,3 +1,6 @@
1+{-# LANGUAGE StandaloneDeriving #-}
2+{-# LANGUAGE GADTs #-}
3+{-# LANGUAGE RankNTypes #-}
14-- Copyright 2009-2010 Corey O'Connor
25-- Display attributes
36--
@@ -69,8 +72,13 @@ data FixedAttr = FixedAttr
6972
7073-- | The style and color attributes can either be the terminal defaults. Or be equivalent to the
7174-- previously applied style. Or be a specific value.
72−data Eq v => MaybeDefault v = Default | KeepCurrent | SetTo !v
73− deriving ( Eq, Show )
75+data MaybeDefault v where
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)
7482
7583instance Eq v => Monoid ( MaybeDefault v ) where
7684 mempty = KeepCurrent