Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- data MyNum = MyInteger Integer
- | MyDouble Double
- | MyRational Rational
- data MyNumType = MyIntegerType | MyDoubleType | MyRationalType deriving (Eq)
- typeOf :: MyNum -> MyNumType
- typeOf (MyInteger _) = MyIntegerType
- typeOf (MyDouble _) = MyDoubleType
- typeOf (MyRational _) = MyRationalType
- -- any (\x -> typeOf x == MyDoubleType) [MyInteger 1, MyInteger 2, MyDouble 3] == True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement