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:  Beginners Digest, Vol 161, Issue 1 (Michael Turner)
   2. Re:  Beginners Digest, Vol 161, Issue 1 (יהושע ולך)
   3. Re:  Beginners Digest, Vol 161, Issue 1 (יהושע ולך)


----------------------------------------------------------------------

Message: 1
Date: Mon, 13 Dec 2021 00:31:34 +0900
From: Michael Turner <michael.eugene.tur...@gmail.com>
To: beginners@haskell.org
Subject: Re: [Haskell-beginners] Beginners Digest, Vol 161, Issue 1
Message-ID:
        <CANHeBiiE6WwVLDyzd7yoqsAgPsauTeePYSbJ3Bt-PMU9y=q...@mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"

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




On Sun, Dec 12, 2021 at 8:48 PM <beginners-requ...@haskell.org> wrote:


> have another look at
> https://hackage.haskell.org/packaggetCallStackgetCallStacke/base-4.16.0.0/docs/GHC-Stack.html#v:callStack
> <https://hackage.haskell.org/package/base-4.16.0.0/docs/GHC-Stack.html#v:callStack>

I'd been looking at that already, over and over. Still not seeing it.
But your proposed fix does work. Thank you.
> let l = getCallStack callStack
> print (length l)
> ```
> the `getCallStack` does not return an "IO" value..

And yet it's it's somehow an IO value in "print (length (getCallStack
callStack))"?

I just don't get this.

> On Sun, Dec 12, 2021, 12:58 Michael Turner <michael.eugene.tur...@gmail.com>
> wrote:
>
> > The following prints 1, as you'd expect:
> > -----------------
> > import GHC.Stack
> >
> > foo :: HasCallStack => IO ()
> > foo = do
> >    print (length (getCallStack callStack))
> >
> > main =
> >   foo
> > -------------------
> > But when I make it this:
> > ...
> >    l <- getCallStack callStack ;
> >    print (length l)
> >
> >  I get all this:
> > ------------------------------------------
> > ...
> >     • Couldn't match type ‘[]’ with ‘IO’
> >       Expected type: IO ([Char], SrcLoc)
> >         Actual type: [([Char], SrcLoc)]
> >     • In a stmt of a 'do' block: l <- getCallStack callStack
> >       In the expression:
> >         do l <- getCallStack callStack
> >            print (length l)
> >       In an equation for ‘foo’:
> >           foo
> >             = do l <- getCallStack callStack
> >                  print (length l)
> >   |
> > 5 |    l <- getCallStack callStack ;
> >   |         ^^^^^^^^^^^^^^^^^^^^^^
> > --------------------------------------------
> >
> > What am I not seeing?
> >
> >
> > 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


------------------------------

Message: 2
Date: Sun, 12 Dec 2021 19:05:22 +0200
From: יהושע ולך <yehoshu...@gmail.com>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <beginners@haskell.org>
Subject: Re: [Haskell-beginners] Beginners Digest, Vol 161, Issue 1
Message-ID:
        <camcanrwgs7lu9uwmgimw2feyxco-5uq82a6x6bnyypcm8bn...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Notice: (from ghci)

Prelude GHC.Stack> :t callStack
callStack :: CallStack
Prelude GHC.Stack> :t getCallStack
getCallStack :: CallStack -> [([Char], SrcLoc)]
Prelude GHC.Stack> :t getCallStack callStack
getCallStack callStack :: [([Char], SrcLoc)]
Prelude GHC.Stack> :t length (getCallStack callStack)
length (getCallStack callStack) :: Int

Prelude GHC.Stack> :t print (length (getCallStack callStack))
print (length (getCallStack callStack)) :: IO ()

Prelude GHC.Stack> :t print
print :: Show a => a -> IO ()


the `print` function takes a pure value, and creates an IO value from it.
(actually printing is an IO action. the value it prints is not)



On Sun, Dec 12, 2021 at 5:32 PM Michael Turner <
michael.eugene.tur...@gmail.com> wrote:

> 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
>
>
>
>
> On Sun, Dec 12, 2021 at 8:48 PM <beginners-requ...@haskell.org> wrote:
>
>
> > have another look at
> >
> https://hackage.haskell.org/packaggetCallStackgetCallStacke/base-4.16.0.0/docs/GHC-Stack.html#v:callStack
> > <
> https://hackage.haskell.org/package/base-4.16.0.0/docs/GHC-Stack.html#v:callStack
> >
>
> I'd been looking at that already, over and over. Still not seeing it.
> But your proposed fix does work. Thank you.
> > let l = getCallStack callStack
> > print (length l)
> > ```
> > the `getCallStack` does not return an "IO" value..
>
> And yet it's it's somehow an IO value in "print (length (getCallStack
> callStack))"?
>
> I just don't get this.
>
> > On Sun, Dec 12, 2021, 12:58 Michael Turner <
> michael.eugene.tur...@gmail.com>
> > wrote:
> >
> > > The following prints 1, as you'd expect:
> > > -----------------
> > > import GHC.Stack
> > >
> > > foo :: HasCallStack => IO ()
> > > foo = do
> > >    print (length (getCallStack callStack))
> > >
> > > main =
> > >   foo
> > > -------------------
> > > But when I make it this:
> > > ...
> > >    l <- getCallStack callStack ;
> > >    print (length l)
> > >
> > >  I get all this:
> > > ------------------------------------------
> > > ...
> > >     • Couldn't match type ‘[]’ with ‘IO’
> > >       Expected type: IO ([Char], SrcLoc)
> > >         Actual type: [([Char], SrcLoc)]
> > >     • In a stmt of a 'do' block: l <- getCallStack callStack
> > >       In the expression:
> > >         do l <- getCallStack callStack
> > >            print (length l)
> > >       In an equation for ‘foo’:
> > >           foo
> > >             = do l <- getCallStack callStack
> > >                  print (length l)
> > >   |
> > > 5 |    l <- getCallStack callStack ;
> > >   |         ^^^^^^^^^^^^^^^^^^^^^^
> > > --------------------------------------------
> > >
> > > What am I not seeing?
> > >
> > >
> > > 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
> _______________________________________________
> 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/20211212/0768f133/attachment-0001.html>

------------------------------

Message: 3
Date: Sun, 12 Dec 2021 19:09:17 +0200
From: יהושע ולך <yehoshu...@gmail.com>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <beginners@haskell.org>
Subject: Re: [Haskell-beginners] Beginners Digest, Vol 161, Issue 1
Message-ID:
        <CAMcanRXxT6Bx9eSgXOzCjdUV7mm7C76LJ6X=hj714hnf3di...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

The important thing here, is that print is a function from a "pure" value
(any type implements the Show typeclass. (similar to trait in rust, or
interface in some languages))
and creates a "IO" value, which can be thought of as a IO action. inside
the IO monad, that just means running it.


‪On Sun, Dec 12, 2021 at 7:05 PM ‫יהושע ולך‬‎ <yehoshu...@gmail.com> wrote:‬

> Notice: (from ghci)
>
> Prelude GHC.Stack> :t callStack
> callStack :: CallStack
> Prelude GHC.Stack> :t getCallStack
> getCallStack :: CallStack -> [([Char], SrcLoc)]
> Prelude GHC.Stack> :t getCallStack callStack
> getCallStack callStack :: [([Char], SrcLoc)]
> Prelude GHC.Stack> :t length (getCallStack callStack)
> length (getCallStack callStack) :: Int
>
> Prelude GHC.Stack> :t print (length (getCallStack callStack))
> print (length (getCallStack callStack)) :: IO ()
>
> Prelude GHC.Stack> :t print
> print :: Show a => a -> IO ()
>
>
> the `print` function takes a pure value, and creates an IO value from it.
> (actually printing is an IO action. the value it prints is not)
>
>
>
> On Sun, Dec 12, 2021 at 5:32 PM Michael Turner <
> michael.eugene.tur...@gmail.com> wrote:
>
>> 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
>>
>>
>>
>>
>> On Sun, Dec 12, 2021 at 8:48 PM <beginners-requ...@haskell.org> wrote:
>>
>>
>> > have another look at
>> >
>> https://hackage.haskell.org/packaggetCallStackgetCallStacke/base-4.16.0.0/docs/GHC-Stack.html#v:callStack
>> > <
>> https://hackage.haskell.org/package/base-4.16.0.0/docs/GHC-Stack.html#v:callStack
>> >
>>
>> I'd been looking at that already, over and over. Still not seeing it.
>> But your proposed fix does work. Thank you.
>> > let l = getCallStack callStack
>> > print (length l)
>> > ```
>> > the `getCallStack` does not return an "IO" value..
>>
>> And yet it's it's somehow an IO value in "print (length (getCallStack
>> callStack))"?
>>
>> I just don't get this.
>>
>> > On Sun, Dec 12, 2021, 12:58 Michael Turner <
>> michael.eugene.tur...@gmail.com>
>> > wrote:
>> >
>> > > The following prints 1, as you'd expect:
>> > > -----------------
>> > > import GHC.Stack
>> > >
>> > > foo :: HasCallStack => IO ()
>> > > foo = do
>> > >    print (length (getCallStack callStack))
>> > >
>> > > main =
>> > >   foo
>> > > -------------------
>> > > But when I make it this:
>> > > ...
>> > >    l <- getCallStack callStack ;
>> > >    print (length l)
>> > >
>> > >  I get all this:
>> > > ------------------------------------------
>> > > ...
>> > >     • Couldn't match type ‘[]’ with ‘IO’
>> > >       Expected type: IO ([Char], SrcLoc)
>> > >         Actual type: [([Char], SrcLoc)]
>> > >     • In a stmt of a 'do' block: l <- getCallStack callStack
>> > >       In the expression:
>> > >         do l <- getCallStack callStack
>> > >            print (length l)
>> > >       In an equation for ‘foo’:
>> > >           foo
>> > >             = do l <- getCallStack callStack
>> > >                  print (length l)
>> > >   |
>> > > 5 |    l <- getCallStack callStack ;
>> > >   |         ^^^^^^^^^^^^^^^^^^^^^^
>> > > --------------------------------------------
>> > >
>> > > What am I not seeing?
>> > >
>> > >
>> > > 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
>> _______________________________________________
>> 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/20211212/c4e14a6b/attachment.html>

------------------------------

Subject: Digest Footer

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners


------------------------------

End of Beginners Digest, Vol 161, Issue 2
*****************************************

Reply via email to