On Thu, May 10, 2007 at 06:13:16PM +0100, Neil Mitchell wrote:
> 
> >> Also remember that evaluating an expression in Haskell is _really_
> >> hard!
> >
> >Really? Looks pretty damn simple to me...
> 
> In that case I throw down the challenge of writing an interpetter that
> takes a Haskell syntax tree and evaluates it :)
> 
> What is the value of show [] ? Remember that show ([] :: String) /=
> show ([] :: [Bool), so I can't see how you can drop the types and keep
> the semantics.

show [] by itself can't be evaluated even with type inference, though. A
more convincing example, IMO, is something like

    class Foo a where
        foo :: a -> String

    instance Foo Bool where
        foo _ = "Bool"

    instance Foo Char where
        foo _ = "Char"

    x :: String
    x = foo (id $! (undefined :: Bool))

where to evaluate x you can't evaluate the argument to foo (in general
it might not terminate) in order to find out what type this instance of
foo needs to have..


Thanks
Ian

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to