[Haskell-cafe] why are implicit types different? (cleanup)
Simon Peyton-Jones
simonpj at microsoft.com
Tue Nov 28 08:25:41 EST 2006
| So I guess the real question is, how do I pass a polytype* wpn?
and the answer is:
| On Mon, 27 Nov 2006, Simon Peyton-Jones wrote:
|
| > Implicit parameters have monotypes, not polytypes.
So an implicit parameter never has a polymorphic type. You can get around this, as Ben suggested I think, by using a newtype to wrap it up:
newtype WPN = WPN (forall a. Ev PassNet ev a -> Ev State ev a)
Simon
So ?f in g gets
| > type (Char->Char). I rather doubt that something more general
| > (implicit parameters get polytypes) would work, given the implicit
| > "improvement" rules that implicit parameters require.
| >
| > Simon
| >
| > | -----Original Message-----
| > | From: haskell-cafe-bounces at haskell.org [mailto:haskell-cafe-bounces at haskell.org] On Behalf Of
| S.
| > | Alexander Jacobson
| > | Sent: 21 November 2006 19:28
| > | To: haskell-cafe at haskell.org
| > | Subject: [Haskell-cafe] why are implicit types different? (cleanup)
| > |
| > |
| > |
| > | Why do g and g' have different types?
| > |
| > | g x y = let ?f = \x-> x in ?f x ++ (show (?f y))
| > | g :: [Char] -> [Char] -> [Char]
| > |
| > | g' :: (Show t) => [Char] -> t -> [Char]
| > | g' x y = let f = \x-> x in f x ++ (show (f y))
| > |
| > | Is there a way I can use implicit types and let g be as general as g'?
| > |
| > | -Alex-
| > |
| > |
| > | ______________________________________________________________
| > | S. Alexander Jacobson tel:917-770-6565 http://alexjacobson.com
| > | _______________________________________________
| > | Haskell-Cafe mailing list
| > | Haskell-Cafe at haskell.org
| > | http://www.haskell.org/mailman/listinfo/haskell-cafe
| >
More information about the Haskell-Cafe
mailing list