Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {-# LANGUAGE StrictData, GADTs, DataKinds, KindSignatures #-}
- {-# LANGUAGE RankNTypes, StandaloneDeriving #-}
- -- this gets suggested, but doesn't help
- -- {-# LANGUAGE UndecidableInstances #-}
- -- this would help but isn't in until 8.6?
- -- {-# LANGUAGE QuantifiedConstraints #-}
- import Data.Kind (Type)
- data State
- = A
- | B
- data Thing :: (State -> State -> Type -> Type) -> Type where
- IntThing :: f a b Int -> f b c Int -> Thing f
- DoubleThing :: f a b Double -> f b c Double -> Thing f
- -- this doesn't work, but suggests -XUndecidableInstances, which also doesn't work
- -- deriving instance (Show (f a b Int), Show (f a b Double)) => Show (Thing f)
- -- this also doesn't work, also suggests -XUndecidableInstances, which also doesn't work
- {-
- instance (Show (f a b Int), Show (f a b Double)) => Show (Thing f) where
- show (IntThing x y) = "IntThing " ++ show x ++ " " ++ show y
- show (DoubleThing x y) = "DoubleThing " ++ show x ++ " " ++ show y
- -}
- -- doesn't work until 8.6 with -XQuantifiedConstraints?
- -- deriving instance (forall i j a . Show a => Show (f i j a)) => Show (Thing f)
Add Comment
Please, Sign In to add comment