Look at the type of (???) (???) :: a -> (a->b) -> b
Nothing about ?foo in there. You're passing a *monomorphic* function to (???), so fun is partially applied to ?foo before calling (???). Simon | -----Original Message----- | From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Eike Scholz | Sent: 27 February 2006 00:14 | To: haskell@haskell.org | Subject: [Haskell] "strange" behavior of Implicit Parameters | | Hi, | | I have just a short question, about the semantics of Implicit parameters | on GHC 6.4. | | Given the following code: | | > (???) x f | > = let ?foo = 1337 | > in f x | | > fun :: (?foo::Int,Show x) => x -> String | > fun x = "x = "++(show x)++"; ?foo = "++(show ?foo) | | > test = let ?foo = 23 | > in 42 ??? fun | | I would expect: | | test == "x = 42; ?foo = 1337" | | Because I thought, that it gets reduced like: | | let ?foo = 23 in 42 ??? fun | ~> let ?foo = 23 in (let ?foo = 1337 in fun 42) | ~> ... | ~> "x = 42; ?foo = 1337" | | however I get | | "x = 42; ?foo = 23" | | in ghci. | | Is there a special reason, why the implicit parameter is reduced first? | Could it be a bug? | | Reducing it my way would be very useful for combinator-libraries, since | it could be used passing around state info, or simple debug text, that | tells where a Runtime-error occured? | | an odd example: | | | > undef = error ?errstr | | > (<?>) x s = let ?errstr = ?errstr++"\n"++s in x -- annotate error tags | | | so error annotations will accumulate and it would be easy to resolve | runtime errors. | | | best regards | | Eike Scholz | | _______________________________________________ | Haskell mailing list | Haskell@haskell.org | http://www.haskell.org/mailman/listinfo/haskell _______________________________________________ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell