From Leonhard.Applis at protonmail.com Wed May 1 11:04:46 2019 From: Leonhard.Applis at protonmail.com (Leonhard Applis) Date: Wed, 01 May 2019 11:04:46 +0000 Subject: [Haskell-beginners] Common Method for [Maybe a] -> [a] Message-ID: Hey there, I've got a method: demaybefy :: [Maybe a] -> [a] demaybefy [] = [] demaybefy (x:xs) = case x of Just x -> x : demaybefy xs Nothing -> demaybefy xs However, i feel that there is a method from preload/list/maybe that does exactly the same, but i cannot find it. Can someone help me? best regards Leonhard -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: publickey - Leonhard.Applis at protonmail.com - 0x807FDDF3.asc Type: application/pgp-keys Size: 1844 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 509 bytes Desc: OpenPGP digital signature URL: From simon.jakobi at googlemail.com Wed May 1 11:24:54 2019 From: simon.jakobi at googlemail.com (Simon Jakobi) Date: Wed, 1 May 2019 13:24:54 +0200 Subject: [Haskell-beginners] Common Method for [Maybe a] -> [a] In-Reply-To: References: Message-ID: Hi Leonhard, the function is called catMaybes. Hoogle is a good way to find it: https://hoogle.haskell.org/?hoogle=%5BMaybe+a%5D+-%3E+%5Ba%5D Cheers, Simon Am Mi., 1. Mai 2019 um 13:05 Uhr schrieb Leonhard Applis < Leonhard.Applis at protonmail.com>: > Hey there, > > I've got a method: > > *demaybefy* :: [Maybe a] -> [a] > demaybefy [] = [] > demaybefy (x:xs) = case x of > Just x -> x : demaybefy xs > Nothing -> demaybefy xs > > > > However, i feel that there is a method from preload/list/maybe that does > exactly the same, but i cannot find it. > Can someone help me? > > best regards > Leonhard > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fa-ml at ariis.it Wed May 1 12:56:20 2019 From: fa-ml at ariis.it (Francesco Ariis) Date: Wed, 1 May 2019 14:56:20 +0200 Subject: [Haskell-beginners] Common Method for [Maybe a] -> [a] In-Reply-To: References: Message-ID: <20190501125620.gpcwypzmryd2osvc@x60s.casa> Hello Leonard, On Wed, May 01, 2019 at 11:04:46AM +0000, Leonhard Applis wrote: > I've got a method: > > demaybefy :: [Maybe a] -> [a] > [...] > > > However, i feel that there is a method from preload/list/maybe that > does exactly the same, but i cannot find it. > Can someone help me? Simon already gave the right answer; never forget that for question like this, Hoogle is phenomenal! Just write in the sought signature and voila: https://hoogle.haskell.org/?hoogle=%5BMaybe%20a%5D%20-%3E%20%5Ba%5D From tonymorris at gmail.com Fri May 3 06:30:18 2019 From: tonymorris at gmail.com (Tony Morris) Date: Fri, 3 May 2019 16:30:18 +1000 Subject: [Haskell-beginners] Common Method for [Maybe a] -> [a] In-Reply-To: <20190501125620.gpcwypzmryd2osvc@x60s.casa> References: <20190501125620.gpcwypzmryd2osvc@x60s.casa> Message-ID: <66205e78-0273-b0b2-281f-bc533da46423@gmail.com> Also in general form. https://hackage.haskell.org/package/witherable-0.3/docs/Data-Witherable.html#v:catMaybes On 1/5/19 10:56 pm, Francesco Ariis wrote: > Hello Leonard, > > On Wed, May 01, 2019 at 11:04:46AM +0000, Leonhard Applis wrote: >> I've got a method: >> >> demaybefy :: [Maybe a] -> [a] >> [...] >> >> >> However, i feel that there is a method from preload/list/maybe that >> does exactly the same, but i cannot find it. >> Can someone help me? > Simon already gave the right answer; never forget that for question like > this, Hoogle is phenomenal! Just write in the sought signature and voila: > > https://hoogle.haskell.org/?hoogle=%5BMaybe%20a%5D%20-%3E%20%5Ba%5D > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 488 bytes Desc: OpenPGP digital signature URL: From borgauf at gmail.com Mon May 27 17:49:59 2019 From: borgauf at gmail.com (Lawrence Bottorff) Date: Mon, 27 May 2019 12:49:59 -0500 Subject: [Haskell-beginners] Emacs org-mode code block problem Message-ID: I've got this in an Emacs org-mode code block: #+begin_src haskell :results output doubleSmallNumber4 x = if x > 0 then x else x * 2 #+end_src but when I try to run it (with C-c C-c) I get ... Prelude> doubleSmallNumber4 x = if x > 0 then x else x * 2 "org-babel-haskell-eoe" :19:23: error: parse error (possibly incorrect indentation or mismatched brackets) Prelude> :20:11: error: parse error (possibly incorrect indentation or mismatched brackets) Prelude> :21:5-8: error: parse error on input ‘then’ Prelude> :22:5-8: error: parse error on input ‘else’ Prelude> "org-babel-haskell-eoe" ... I can run #+begin_src haskell tripleMe x = x + x + x #+end_src just fine though -- which means I've done something right with my Emacs init. The REPL started is 8.6.3 stack-ghci. I've formatted with the org-mode C-c ' LB -------------- next part -------------- An HTML attachment was scrubbed... URL: From borgauf at gmail.com Tue May 28 18:56:06 2019 From: borgauf at gmail.com (Lawrence Bottorff) Date: Tue, 28 May 2019 13:56:06 -0500 Subject: [Haskell-beginners] Where is my stack ghci? Message-ID: I've installed Haskell the stack way, but a > which ghc or > whcih ghci comes up with nothing. How can I tell my (Ubuntu 19.04) system where to find ghci? LB -------------- next part -------------- An HTML attachment was scrubbed... URL: From brodyberg at gmail.com Tue May 28 19:32:39 2019 From: brodyberg at gmail.com (Brody Berg) Date: Tue, 28 May 2019 12:32:39 -0700 Subject: [Haskell-beginners] Where is my stack ghci? In-Reply-To: References: Message-ID: stack ghci On Tue, May 28, 2019 at 11:56 Lawrence Bottorff wrote: > I've installed Haskell the stack way, but a > > > which ghc > > or > > > whcih ghci > > comes up with nothing. How can I tell my (Ubuntu 19.04) system where to > find ghci? > > LB > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at snoyman.com Wed May 29 02:31:50 2019 From: michael at snoyman.com (Michael Snoyman) Date: Wed, 29 May 2019 05:31:50 +0300 Subject: [Haskell-beginners] Where is my stack ghci? In-Reply-To: References: Message-ID: You can also use `stack exec which ghc` to find the executable. On Tue, May 28, 2019 at 10:33 PM Brody Berg wrote: > stack ghci > > On Tue, May 28, 2019 at 11:56 Lawrence Bottorff wrote: > >> I've installed Haskell the stack way, but a >> >> > which ghc >> >> or >> >> > whcih ghci >> >> comes up with nothing. How can I tell my (Ubuntu 19.04) system where to >> find ghci? >> >> LB >> _______________________________________________ >> Beginners mailing list >> Beginners at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners >> > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > -------------- next part -------------- An HTML attachment was scrubbed... URL: