infixed implicit parameters

Simon Peyton-Jones simonpj@microsoft.com
Mon, 29 Jul 2002 10:56:18 +0100


Reasonable suggestion, and not hard to implement.

Definitions are more troublesome.  Currently implicit parameter
bindings must be of the form
	?x =3D e
I.e. no pattern-matching, function defintions etc.   Changing this would
be quite a bit more work. =20

One could imagine

a) status quo=20
b) allow infix application, but keep binding syntactically restricted
c) allow arbitrary binding forms (pattern matching etc)

I think (b) is defensible; I don't think (c) is worth the work.  But I
would
prefer to do (b) in sync with Hugs.  Let's see what they think.

Simon

| -----Original Message-----
| From: Hal Daume III [mailto:hdaume@ISI.EDU]=20
| Sent: 23 July 2002 18:38
| To: GHC Users Mailing List
| Subject: infixed implicit parameters
|=20
|=20
| in the cannonical sort with implicit params, i we write=20
| something like:
|=20
| mySort :: (?cmp :: a -> a -> Ordering) =3D> [a] -> [a]
| mySort [] =3D []
| mySort (x:xs) =3D insert x (mySort xs)
|     where insert x [] =3D [x]
| 	  insert x (y:ys)
| 		 | ?cmp x y =3D=3D GT =3D y : insert x ys
| 		 | otherwise      =3D x : y : ys
|=20
| but we cannot write for the second-to-last line:
|=20
|   x `?cmp` y
|=20
| or
|=20
|   x ?`cmp` y
|=20
| any chance this will be changed (my preference would be for=20
| the first one.
|=20
|  - hal
|=20
| --
| Hal Daume III
|=20
|  "Computer science is no more about computers    | hdaume@isi.edu
|   than astronomy is about telescopes." -Dijkstra | www.isi.edu/~hdaume
|=20
| _______________________________________________
| Glasgow-haskell-users mailing list=20
| Glasgow-haskell-users@haskell.org=20
| http://www.haskell.org/mailman/listinfo/glasgow-| haskell-users
|=20