Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Truthy t where
- truthy :: Integer -> t
- instance Truthy Integer where
- truthy x = x -- some computation that results in an Integer
- instance Truthy Bool where
- truthy x = x /= 0 -- some computation that results in a Bool
- Prelude> let y = truthy 17
- Prelude> if y then y else 42
- 17
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement