[Haskell-beginners] import not working

Galaxy Being borgauf at gmail.com
Sat Jun 5 03:47:57 UTC 2021


I run ghci with

> stack ghci



On Fri, Jun 4, 2021 at 5:19 PM Jesse Rudel <jesse.rudel at 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 <borgauf at 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
>> borgauf at gmail.com
>> _______________________________________________
>> 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
>


-- 
⨽
Lawrence Bottorff
Grand Marais, MN, USA
borgauf at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20210604/5a34d3c3/attachment-0001.html>


More information about the Beginners mailing list