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. Re: Is it possible to use a <> constructor in analogy to [] ? (Carl Eyeinsky) ---------------------------------------------------------------------- Message: 1 Date: Fri, 29 Jan 2016 14:22:37 +0100 From: Carl Eyeinsky <eyeins...@gmail.com> To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell <beginners@haskell.org> Subject: Re: [Haskell-beginners] Is it possible to use a <> constructor in analogy to [] ? Message-ID: <cadkv3aggtby90p+cmy9nuqbxjazwuz_ct67_gt5dps8mpme...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" If you write the literal in a string, apply 'read' and specify the type, then it should work. If you write it in a string literal, then it might be that you need to use defaulting to get it to evaluate to Crust. If you write just a bare <...> in ghci then afaik that won't ever work, as there's a fixed set of literals ghc's parser accepts. On Jan 27, 2016 9:44 PM, "martin" <martin.drautzb...@web.de> wrote: > Hello all, > > I've written my own Read and Show instances for a type, which is > essentially > > data Crust a = Open [a] | Closed [a] > > "Show" does something like > > *Main> Closed [1,2,3] > <1,2,3> > *Main> Open [1,2,3] > <1,2,3..> > > And Read faithully parses each stings and turns it into a Crust again. > > Problem is: when I just type <1,2,3..> in GHCi I get a "parse error on > input ?<?". However when I spell out the > custructor as above it parses it okay. > > Is it possible at all to write my own <> constructor, or something like it= > _______________________________________________ > 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/20160129/b7e04f10/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 37 *****************************************