[Haskell-cafe] Learn You a Haskell for Great Good - a few doubts

Daniel Fischer daniel.is.fischer at googlemail.com
Tue Mar 8 01:34:38 CET 2011

On Tuesday 08 March 2011 00:58:36, Alexander Solla wrote:
> As a matter of fact, if you read GHC.Prim, you will see that seq is a
> bottom!

No, you don't. GHC.Prim is a dummy module whose only purpose is to let 
haddock generate documentation. Every function there has the code
let x = x in x, e.g.

plusWord# :: Word# -> Word# -> Word#
plusWord# = let x = x in x

minusWord# :: Word# -> Word# -> Word#
minusWord# = let x = x in x

undefined is not yet available, otherwise probably everything in GHC.Prim 
would be pseudo-defined as undefined for haddock.

> seq :: a -> b -> b
> seq = let x = x in x
> The "magic" semantics of evaluating the first argument are done by the
> compiler/runtime, and are apparently not expressible in Haskell.

But neither is addition of Word# etc., for the primitives, you have to do 
something special.

> This is true of
> inline
> lazy
> unsafeCoerce
> and dozens of others, all of which are expressed as specialized types
> with the same equation:
> let x = x in x

More information about the Haskell-Cafe mailing list