| Safe Haskell | Safe |
|---|---|
| Language | Haskell2010 |
Data.Diverse.CaseFunc
Documentation
newtype CaseFunc k r xs Source #
This handler stores a polymorphic function that returns a different type.
let y =pick(5 :: Int) ::Which'[Int, Bool]switchy (CaseFunc@Typeable(show . typeRep . (pure @Proxy))) `shouldBe` Int
let x = (5 :: Int)./False./'X'./Just 'O'./(6 :: Int)./Just 'A'./nulafoldr(:) [] (forMany(CaseFunc@Typeable(show . typeRep . (pure @Proxy))) x) `shouldBe` ["Int", "Bool", "Char", "Maybe Char", "Int", "Maybe Char"]
Constructors
| CaseFunc (forall x. k x => x -> r) |
newtype CaseFunc' k xs Source #
This handler stores a polymorphic function that doesn't change the type.
let x = (5 :: Int)./(6 :: Int8)./(7 :: Int16)./(8 :: Int32)./nily = (15 :: Int)./(16 :: Int8)./(17 :: Int16)./(18 :: Int32)./nilafmap(CaseFunc'@Num(+10)) x `shouldBe` y
Constructors
| CaseFunc' (forall x. k x => x -> x) |