Send Beginners mailing list submissions to beginners@haskell.org To subscribe or unsubscribe via the World Wide Web, visit http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners or, via email, send a message with subject or body 'help' to beginners-requ...@haskell.org
You can reach the person managing the list at beginners-ow...@haskell.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Beginners digest..." Today's Topics: 1. Why must inflix constructors begin with a colon? (Olumide) 2. Parametrizing [] as an instance of the Functor type class (Olumide) 3. Re: Parametrizing [] as an instance of the Functor type class (Alexander Berntsen) 4. Re: Parametrizing [] as an instance of the Functor type class (Daniel Trstenjak) 5. Re: Why must inflix constructors begin with a colon? (Francesco Ariis) 6. Re: Why must inflix constructors begin with a colon? (Norbert Melzer) ---------------------------------------------------------------------- Message: 1 Date: Thu, 31 Dec 2015 12:52:44 +0000 From: Olumide <50...@web.de> To: beginners@haskell.org Subject: [Haskell-beginners] Why must inflix constructors begin with a colon? Message-ID: <5685251c.9000...@web.de> Content-Type: text/plain; charset=utf-8; format=flowed I'm new to Haskell and wondering why this restriction? For example (from LYH): infixr 5 :-: data List a = Empty | a :-: (List a) deriving (Show, Read, Eq, Ord) Thanks, - Olumide ------------------------------ Message: 2 Date: Thu, 31 Dec 2015 13:06:18 +0000 From: Olumide <50...@web.de> To: beginners@haskell.org Subject: [Haskell-beginners] Parametrizing [] as an instance of the Functor type class Message-ID: <5685284a.3010...@web.de> Content-Type: text/plain; charset=utf-8; format=flowed According to LYH, the list is an instance of the Functor type class: instance Functor [] where fmap = map Why does 'f' not appear in this expression?, considering that Functor is defined as class Functor f where fmap :: (a -> b) -> f a -> f b Overall, I'm a bit confused about the relationship between the type constructor f and []. Thanks, - Olumide ------------------------------ Message: 3 Date: Thu, 31 Dec 2015 14:10:18 +0100 From: Alexander Berntsen <alexan...@plaimi.net> To: beginners@haskell.org Subject: Re: [Haskell-beginners] Parametrizing [] as an instance of the Functor type class Message-ID: <5685293a.7020...@plaimi.net> Content-Type: text/plain; charset=windows-1252 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 On 31/12/15 14:06, Olumide wrote: > Overall, I'm a bit confused about the relationship between the type > constructor f and []. f = []. In other words, [] *is* the type constructor. In Haskell, [] is both the type constructor for lists *and* the term level value for an empty list. This is unfortunate. In ghci you can see this. ? :t [] [] :: [t] -- term level ? :k [] [] :: * -> * -- type level - -- Alexander alexan...@plaimi.net https://secure.plaimi.net/~alexander -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCgAGBQJWhSk5AAoJENQqWdRUGk8BPHcQAOHzfxcEQ+ZTQ5VMZjNo2cC5 5dXKFg2h0jGho4FhUNWeJ4EPSiyYHTEmyK3ZL2KSYoTVAPq/PyeZMdJFRgVRAeyz Ktyv00E9oJQqjxUrZi7YiE+Y/KteqjE8Hy0X9QW7ICgcU1M9a13o6L+CLdoYrCj8 K6Dto35O7aZRLLQTjoZBm0I6VeDF9WDJPQwZrmXopXhixKrEad8EPne/Tt/yXlTr Yl2Wya5w+f/xkD6G3T7nHz6Z2CtVhzfqTMO+9OoDkNnt8kFC1ZCsdDicbryEcvEA 0WlURPfjTMRCffrKz8N5SeyzgSF29EJATY2U9yg1l2gajiHxo+Veg1HXF2EMr5RZ HF1DJyykXOOpel2VBY+ljtUsVP2J1gF7CoGjAzQnIQhGq3n/DOzmieRCZrZ4eC2W 8gUKyQwd4VPSI+YCZ+io9/NIXETpA+TIUdEYI5Goje4laN5lvddwAc0ADAbWPfyt bsVjlmu3nC3EhG/7qw3KfA4KBiCXU8hH+8zvzDFYjBMX2bxnd/42jiJ8HyNVPYhW s1FB3ndNUU/tHQzsSye3DXdL6mZ/PsDCT4RAcKc6HMTOP2K04DR8Nmo9Ag6RV0Pw VomcJkESFZYYG1vPrdbxDRAWJgGIsMd1UpuPe5r6uzj06Xh9zmoLIqVxB3u2Um8k AnGPKK8WBdguP09bjG0Q =8v7y -----END PGP SIGNATURE----- ------------------------------ Message: 4 Date: Thu, 31 Dec 2015 14:35:36 +0100 From: Daniel Trstenjak <daniel.trsten...@gmail.com> To: beginners@haskell.org Subject: Re: [Haskell-beginners] Parametrizing [] as an instance of the Functor type class Message-ID: <20151231133536.GA4227@octa> Content-Type: text/plain; charset=us-ascii On Thu, Dec 31, 2015 at 01:06:18PM +0000, Olumide wrote: > Why does 'f' not appear in this expression?, considering that Functor is > defined as instance Functor [] where fmap = map is the eta reduced - search for eta reduction for the details - of a version like: instance Functor [] where fmap g f = map g f Greetings, Daniel ------------------------------ Message: 5 Date: Thu, 31 Dec 2015 14:33:06 +0100 From: Francesco Ariis <fa...@ariis.it> To: beginners@haskell.org Subject: Re: [Haskell-beginners] Why must inflix constructors begin with a colon? Message-ID: <20151231133306.ga8...@casa.casa> Content-Type: text/plain; charset=us-ascii On Thu, Dec 31, 2015 at 12:52:44PM +0000, Olumide wrote: > I'm new to Haskell and wondering why this restriction? > > For example (from LYH): > > infixr 5 :-: > data List a = Empty | a :-: (List a) deriving (Show, Read, Eq, Ord) Not a committee member, but there is a similar restriction (dichotomy, rather) with 'functions' (first char lowercase) and 'constructors' (first char uppercase), so mirroring it to infix operators/constructors seems reasonable. ------------------------------ Message: 6 Date: Thu, 31 Dec 2015 13:42:50 +0000 From: Norbert Melzer <timmel...@gmail.com> To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell <beginners@haskell.org> Subject: Re: [Haskell-beginners] Why must inflix constructors begin with a colon? Message-ID: <CA+bCVsuuYTx6m04LtyYe2azvq=phhta7tparqjpuijjgpej...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" I'm not a member of the commitee either, but I do think it is to make the grammar context free and give the parser an easy way to distinguish. Because of the design as it is now, already a lexer can decide whether we have a function or an constructor operator. Francesco Ariis <fa...@ariis.it> schrieb am Do., 31. Dez. 2015 14:35: > On Thu, Dec 31, 2015 at 12:52:44PM +0000, Olumide wrote: > > I'm new to Haskell and wondering why this restriction? > > > > For example (from LYH): > > > > infixr 5 :-: > > data List a = Empty | a :-: (List a) deriving (Show, Read, Eq, Ord) > > Not a committee member, but there is a similar restriction (dichotomy, > rather) with 'functions' (first char lowercase) and 'constructors' > (first char uppercase), so mirroring it to infix operators/constructors > seems reasonable. > _______________________________________________ > Beginners mailing list > Beginners@haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.haskell.org/pipermail/beginners/attachments/20151231/476706be/attachment-0001.html> ------------------------------ Subject: Digest Footer _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners ------------------------------ End of Beginners Digest, Vol 91, Issue 1 ****************************************