[Haskell-cafe] Printing and Referential transparency excuse

Cristian Baboi cristian.baboi at gmail.com
Mon Dec 24 04:15:18 EST 2007


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 ?

I'm at the begining of chapter 7, but I have the feeling I'll not find the  
answer in there.


Thank you.

 


More information about the Haskell-Cafe mailing list