
24 Dec
2007
24 Dec
'07
4:27 a.m.
Cristian Baboi wrote:
While reading the Haskell language report I noticed that function type is not an instance of class Read.
I was told that one cannot define them as an instance of class Show without breaking "referential transparency" or printing a constant.
f :: (a->b)->String f x = "bla bla bla"
How can I define a function to do the inverse operation ? g :: String -> ( a -> b )
This time I cannot see how referential transparency will deny it. What's the excuse now ?
The new excuse is that a better name for g is full-fledged-compiler :: String -> (Int -> Int) (the function returned by g better not have a polymorphic type). Which programming language should the argument String be written in? Regards apfelmus