-
Notifications
You must be signed in to change notification settings - Fork 0
Hard To Understand Programs
Iain Moncrief edited this page Oct 29, 2022
·
6 revisions
Iain Moncrief
-- CS 581
nats :: [Int]
nats = 1 : map (+1) nats
undefined :: a
undefined = undefined
-- CS 581
class Castable a b where
cast :: a -> b
instance Castable Int Float where
cast n = (float)n -- lol
instance Castable Int Double where
cast n = intToDouble n
{-- Oh no! Some weird error about "undecidability" --}
{--
There is another error message I can't replicate but I see a lot.
It says something about: Cannot construct infinite type a ~ a' or something weird.
I still don't know what this means, but once I annotate my function, it almost always goes away.
I have seen it a lot more recently in the recent GHCi versions.
--}