How to apply a polymorphic function to both sides of an Either?

后端 未结 0 1810
独厮守ぢ
独厮守ぢ 2020-12-06 02:52

I tried this:

type TestT = Either Int Float

testM :: (a -> a) -> TestT -> TestT
testM f (Left x) = Left (f x)
testM f (Right x) = Right (f x)


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题