[Haskell-cafe] Using -> as both type and value constructor

Armando Blancas abm221617 at gmail.com
Wed Aug 24 20:24:14 CEST 2011


Studying the paper *A Simple Implementation for Priority Search Queues*, by
Ralf Hinze, I came across the following syntax that I didn't understand and
I couldn't use in GHCi 7.0.3 for defining a binding data type (page 3):

Bindings are represented by the following data type:
*data k -> p = k -> p*
key :: (k -> p) -> k
key (k -> p) = k
prio :: (k -> p) -> p
prio (k -> p) = p
Note that we use '->' both as a type constructor and value constructor.
[...] data PSQ k p

The following page has these value constructors:

*0 :: PSQ k p*
*{.} :: (k -> p) -> PSQ k p*


The paper says that's Haskell '98 code. I'll appreciate info on what kind of
data declaration those are and any pointers to related documentation. Or
maybe those are deprecated features. I'm stuck in this part.

-armando

www.cs.ox.ac.uk/people/ralf.hinze/talks/ICFP01.pdf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110824/47b89436/attachment.htm>


More information about the Haskell-Cafe mailing list