In a similar problem as the one showed in this question, is it possible to have a Haskell expression of “generic” type a? Something like,
myExpression :: a
I’m new to Haskell, but from what i’ve been seeing this cannot be achieved.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, there is nothing that satisfies that other than bottom, e.g.
Is there any reasonable way that it could be possible? Some non-bottom expression that is both an
Integerand of typeMaybe (String -> IO ())(for example).Furthermore, given the question you mention, one answer of which proved that the only non-bottom function with type signature
a -> aisid, we have a proof that there can’t be a non-bottom expression with typea. If there was, thencould have type
a -> a, and this is neitheridnor bottom, i.e. a contradiction.