Re:Reimplementing “git clone” in Haskell from the bottom up ...
by Retra on Sunday December 07, 2014 @06:11PM
(#8713997)
The mixfix notation in Agda seems really amazing. I am always wishing I could write code like "add _ to _" or "sort _ by _", etc...
[ Parent
| on HN ]
Re:Reimplementing “git clone” in Haskell from the bottom up ...
by eru on Sunday December 07, 2014 @09:25PM
(#8714595)
Haskell has sortBy and comparing, like this:
sortBy (comparing salary) employees
The grammar is not as close to English, but close enough to understand.
Re:Reimplementing “git clone” in Haskell from the bottom up ...
by pdpi on Monday December 08, 2014 @05:27AM
(#8715794)
The canonical example there is actually to use on and infix `` notation:
sortBy (compare `on` salary) employeers
Re:Reimplementing “git clone” in Haskell from the bottom up ...
by beagle3 on Sunday December 07, 2014 @07:21PM
(#8714260)
It's almost exactly smalltalk (circa 1980 or so) notation.
Re:Reimplementing “git clone” in Haskell from the bottom up ...
by chriswarbo on Monday December 08, 2014 @11:40AM
(#8717328)
Maude also allows mixfix like Agda.
There's an interesting example in the manual ( http://maude.cs.uiuc.edu/maude1/manual/maude-manual-html/mau... ) where juxtaposition is defined as an operation, specifically:
op __ : Bits Bits -> Bits [assoc] .
The underscores are placeholders for arguments, just like in Agda, but there's no name defined! Since `0` and `1` are defined as constructors of `Bit` (which is a sub-type of `Bits`) this will parse values like `0101010` as `Bits`.
Re:Reimplementing “git clone” in Haskell from the bottom up ...
by Peaker on Monday December 08, 2014 @02:29AM
(#8715386)
Agda mixfix supports things like:
[ foo ]
bar !
! baz
etc.It also supports precedence parsing.
I don't Smalltalk can do all of these.
Smalltalk, unlike Agda, can probably omit the spacing around operators, though, while Agda can't :)
Re:Reimplementing “git clone” in Haskell from the bottom up ...
by beagle3 on Monday December 08, 2014 @03:14AM
(#8715467)
I probably should look more closely at Agda.
But the if_then_else_ example is basically smalltalk equivalant - although I suspect Agda will be able to do without the angle brackets that Smalltalk often needs in these cases.