
I have some questions about terminology re types and type constructors. If we have data Tree a = Branch (Tree a) (Tree a) | Leaf a Then is 'Tree' a type constructor? Is it correct to say: - 'Tree' is parameterized by one type, a - 'Tree a' is a type Regarding (->): - Is (->) a type constructor parameterized by two types? - Is (->) an operator? If so, it is the only operator that is also a type constructor? Thanks, Mike

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 7/1/10 12:32 , Michael Mossey wrote:
Regarding (->):
- Is (->) a type constructor parameterized by two types? - Is (->) an operator? If so, it is the only operator that is also a type constructor?
Yes to both, at least in Haskell 98. - -- brandon s. allbery [linux,solaris,freebsd,perl] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.10 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkws1uYACgkQIn7hlCsL25WfzwCfe7KbeMhuPM6JFU2NIQAG3tps mA4AoNIZoKdvIO4eL7OkKwRmLtDhtSor =BwP/ -----END PGP SIGNATURE-----

So, is it possible for me to define a parametric type with an infix binary
data constructor?
On Thu, Jul 1, 2010 at 13:56, Brandon S Allbery KF8NH
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 7/1/10 12:32 , Michael Mossey wrote:
Regarding (->):
- Is (->) a type constructor parameterized by two types? - Is (->) an operator? If so, it is the only operator that is also a type constructor?
Yes to both, at least in Haskell 98.
- -- brandon s. allbery [linux,solaris,freebsd,perl] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.10 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkws1uYACgkQIn7hlCsL25WfzwCfe7KbeMhuPM6JFU2NIQAG3tps mA4AoNIZoKdvIO4eL7OkKwRmLtDhtSor =BwP/ -----END PGP SIGNATURE----- _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
-- mac

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 7/1/10 14:48 , matthew coolbeth wrote:
So, is it possible for me to define a parametric type with an infix binary data constructor?
With the appropriate extension, you can declare an infix type or data constructor using a symbol starting with `:':
data Listy a = Nil | a :*: Listy a
http://www.haskell.org/ghc/docs/6.12.2/html/users_guide/data-type-extensions... - -- brandon s. allbery [linux,solaris,freebsd,perl] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.10 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkws5bgACgkQIn7hlCsL25VhEACgxv82olCE0gdBxjRVx+1Gqvv2 nkgAn1UJ5dGCza6qfW+FK7POSOcFY96F =PT6o -----END PGP SIGNATURE-----

On Thursday 01 July 2010 21:00:08, Brandon S Allbery KF8NH wrote:
On 7/1/10 14:48 , matthew coolbeth wrote:
So, is it possible for me to define a parametric type with an infix binary data constructor?
With the appropriate extension, you can declare an infix type or data
To clarify: for infix data constructors, no extension is needed, they're in Haskell98. To define and infix type constructor, you need the TypeOperators language extension.
constructor using a symbol starting with `:':
data Listy a = Nil | a :*: Listy a
^ Haskell98 {-# LANGUAGE TypeOperators #-} data a :+: b = a :+: b deriving (Eq, Ord, Show) ^ not H98
http://www.haskell.org/ghc/docs/6.12.2/html/users_guide/data-type-extens ions.html#infix-tycons
participants (4)
-
Brandon S Allbery KF8NH
-
Daniel Fischer
-
matthew coolbeth
-
Michael Mossey