Add instance for Show1 for Annotation and NExprF
This commit is contained in:
parent
6c0683eff3
commit
e87bd3b67a
|
@ -13,6 +13,7 @@ import Control.Monad hiding (forM_, mapM, sequence)
|
|||
import Data.Data
|
||||
import Data.Fix
|
||||
import Data.Foldable
|
||||
import Data.Functor.Classes (Show1(..))
|
||||
import Data.Map (Map)
|
||||
import Data.Text (Text, pack)
|
||||
import Data.Traversable
|
||||
|
@ -71,6 +72,9 @@ data NExprF r
|
|||
-- ^ Assert that the first returns true before evaluating the second.
|
||||
deriving (Ord, Eq, Generic, Typeable, Data, Functor, Show)
|
||||
|
||||
instance Show1 NExprF where
|
||||
showsPrec1 = showsPrec
|
||||
|
||||
-- | We make an `IsString` for expressions, where the string is interpreted
|
||||
-- as an identifier. This is the most common use-case...
|
||||
instance IsString NExpr where
|
||||
|
|
|
@ -13,6 +13,7 @@ import Control.Monad hiding (forM_, mapM, sequence)
|
|||
import Data.Data
|
||||
import Data.Fix
|
||||
import Data.Function (on)
|
||||
import Data.Functor.Classes (Show1(..))
|
||||
import Data.Functor.Compose
|
||||
import Data.Semigroup
|
||||
import GHC.Generics
|
||||
|
@ -36,6 +37,9 @@ data Ann ann a = Ann{ annotation :: ann
|
|||
}
|
||||
deriving (Ord, Eq, Data, Generic, Functor, Read, Show)
|
||||
|
||||
instance Show ann => Show1 (Ann ann) where
|
||||
showsPrec1 = showsPrec
|
||||
|
||||
instance Semigroup SrcSpan where
|
||||
s1 <> s2 = SrcSpan ((min `on` spanBegin) s1 s2)
|
||||
((max `on` spanEnd) s1 s2)
|
||||
|
|
Loading…
Reference in a new issue