[Haskell-cafe] Re: Laziness question

Brandon S Allbery KF8NH allbery at ece.cmu.edu
Mon Aug 2 12:59:08 EDT 2010

Hash: SHA1

On 8/2/10 11:41 , Janis Voigtländer wrote:
> alright that we don't know more about where (==) is used. But for a
> function of type f :: Eval (a -> Int) => (a -> Int) -> (a -> Int) ->
> Int, in connection with trying to find out whether uses of seq are
> harmful or not, it is absolutely *essential* to know on which of the two
> functions (a -> Int) seq is used. The type class approach cannot tell

Hm.  Seems to me that (with TypeFamilies and FlexibleContexts)

> h :: (x ~ y, Eval (y -> Int)) => (x -> Int) -> (y -> Int) -> Int

should do that, but ghci is telling me it isn't (substituting Eq for Eval
for the nonce):

  Prelude> let h :: (x ~ y, Eq (y -> Int)) => (x -> Int) -> (y -> Int) ->
Int; h = undefined
  Prelude> :t h
  h :: (Eq (x -> Int)) => (x -> Int) -> (x -> Int) -> Int

Bleah.  (as if it weren't obvious) I still don't quite grok this stuff....

- -- 
brandon s. allbery     [linux,solaris,freebsd,perl]      allbery at kf8nh.com
system administrator  [openafs,heimdal,too many hats]  allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university      KF8NH
Version: GnuPG v2.0.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/


More information about the Haskell-Cafe mailing list