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: import not working (Galaxy Being) 2. Re: import not working (Travis Cardwell) 3. Better intro to the All About Monads tutorial? (Michael Turner) ---------------------------------------------------------------------- Message: 1 Date: Sat, 5 Jun 2021 17:23:32 -0500 From: Galaxy Being <borg...@gmail.com> To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell <beginners@haskell.org> Subject: Re: [Haskell-beginners] import not working Message-ID: <CAFAhFSUZ7ARhDWaqmy7Pa2o0LWe8rZ1QJFzen1oSwyy=iww...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" Let me reiterate, I'm not creating a stack project formally. I'm just going to some directory at the command prompt and firing up ghci, which I presume just uses the global installs. Then I'm creating .hs files in a text editor and trying to load them at the REPL. How can I install stuff in this instance? On Fri, Jun 4, 2021 at 10:47 PM Galaxy Being <borg...@gmail.com> wrote: > I run ghci with > > > stack ghci > > > > On Fri, Jun 4, 2021 at 5:19 PM Jesse Rudel <jesse.ru...@gmail.com> wrote: > >> How are you invoking ghci? If it's a stack project you can try stack ghci >> if you haven't already. >> >> On Fri, 4 Jun 2021 at 21:51, Galaxy Being <borg...@gmail.com> wrote: >> >>> I go to a directory. I run >>> >>> stack install Safe >>> >>> I start up ghci and get the Prelude prompt. I run >>> >>> import Safe >>> >>> and I get >>> >>> import Safe >>> | ^^^^^^^^^^^ >>> Failed, no modules loaded. >>> >>> I'm once again frustrated. I try to load this hs file >>> >>> {-# LANGUAGE ViewPatterns #-} >>> {-# LANGUAGE NoMonomorphismRestriction #-} >>> >>> import Safe >>> >>> lookupDefault :: Eq a => a -> b -> [(a,b)] -> b >>> lookupDefault k _ (lookup k -> Just s) = s >>> lookupDefault _ d _ = d >>> >>> headTup :: (a, [t]) -> [t] >>> headTup (headMay . snd -> Just n) = [n] >>> headTup _ = [] >>> >>> headNil :: [a] -> [a] >>> headNil (headMay -> Just x) = [x] >>> headNil _ = [] >>> >>> with the same result. What do I need to do? >>> -- >>> ⨽ >>> Lawrence Bottorff >>> Grand Marais, MN, USA >>> borg...@gmail.com >>> _______________________________________________ >>> Beginners mailing list >>> Beginners@haskell.org >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners >>> >> _______________________________________________ >> Beginners mailing list >> Beginners@haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners >> > > > -- > ⨽ > Lawrence Bottorff > Grand Marais, MN, USA > borg...@gmail.com > -- ⨽ Lawrence Bottorff Grand Marais, MN, USA borg...@gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.haskell.org/pipermail/beginners/attachments/20210605/664a324d/attachment-0001.html> ------------------------------ Message: 2 Date: Sun, 6 Jun 2021 09:32:25 +0900 From: Travis Cardwell <travis.cardw...@extrema.is> To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell <beginners@haskell.org> Subject: Re: [Haskell-beginners] import not working Message-ID: <CACaJP_T3=7+uhu1oejuifl2revgtdx5vtoj3mnhejqeuqfd...@mail.gmail.com> Content-Type: text/plain; charset="UTF-8" The `stack ghci` command does not load extra packages such as those installed "globally." This is a good thing, IMHO. You can instruct the command to load specific packages using the `--package` option. Example: stack repl --package safe Example using your file: stack repl --package safe GalaxyBeing.hs Note that your email indicates usage of the `Safe` package (uppercase), but that package is deprecated in favor of the `safe` package (lowercase). I mention it in case it is not intentional. * <https://hackage.haskell.org/package/safe> * <https://hackage.haskell.org/package/Safe> You may want to create a project that is just for testing. You can then specify which Stack snapshot to use in `stack.yaml` and which packages to use in `package.yaml`. stack new experiment Travis ------------------------------ Message: 3 Date: Sun, 6 Jun 2021 10:50:08 +0900 From: Michael Turner <michael.eugene.tur...@gmail.com> To: beginners@haskell.org Subject: [Haskell-beginners] Better intro to the All About Monads tutorial? Message-ID: <CANHeBihjJLL_t=-8vj2e9dZQT5T7Pr=ozgew_q9okq8p7bc...@mail.gmail.com> Content-Type: text/plain; charset="UTF-8" I've done some work on this page: https://wiki.haskell.org/All_About_Monads I could use some help in improving my improvements 1. Beginners -- if you haven't looked at monads yet, does this new intro boost your confidence? 2. Those who help beginners here -- have I committed any technical errors? I was a little frustrated about the text as it stood. For example: "... a monad is a way to structure computations in terms of values and sequences of computations using typed values. Monads allow the programmer to build up computations using sequential building blocks, which can themselves be sequences of computations. The monad determines how combined computations form a new computation and frees the programmer from having to code the combination manually each time it is required." The problem with this was that you could substitute "compiler" or "C++ class" and it would be not much less true and not much more uninformative. The approach I took to rewriting (aside from where I take the reader's hand gently at the beginning) was to try to anchor the treatment more in concepts that the reader might already understand. The two main concepts were were pipelines (as in shell programming) and "cross-cutting concerns" (with links to Wikipedia articles for readers who might not know one or the other or both.) I've left almost all of the original wording intact and just wrote around it. Perhaps it could be trimmed, maybe even a lot. I don't understand monads well enough to write one myself yet. But I think a newbie perspective can help in writing for newbies: unlike the expert, the sources of confusion and incomprehension are fresh in your mind, as are the ways you got past them. Regards, Michael Turner Executive Director Project Persephone 1-25-33 Takadanobaba Shinjuku-ku Tokyo 169-0075 Mobile: +81 (90) 5203-8682 tur...@projectpersephone.org Understand - http://www.projectpersephone.org/ Join - http://www.facebook.com/groups/ProjectPersephone/ Donate - http://www.patreon.com/ProjectPersephone Volunteer - https://github.com/ProjectPersephone "Love does not consist in gazing at each other, but in looking outward together in the same direction." -- Antoine de Saint-Exupéry ------------------------------ Subject: Digest Footer _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners ------------------------------ End of Beginners Digest, Vol 155, Issue 4 *****************************************