Send Beginners mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1. Re:  Combining IO and Either function to "EitherT e IO a"
      (Tim Perry)
   2. Re:  Combining IO and Either function to "EitherT e IO a"
      (David Thomas)
   3. Re:  Combining IO and Either function to "EitherT e IO a"
      (Brent Yorgey)
   4. Re:  Combining IO and Either function to "EitherT e IO a"
      (Brent Yorgey)
   5. Re:  Combining IO and Either function to "EitherT e IO a"
      (David Thomas)
   6. Re:  Using GHCi, import submodule that needs to import
      another submodule? (Daniel Trstenjak)


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

Message: 1
Date: Wed, 5 Mar 2014 15:19:48 -0800
From: Tim Perry <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Combining IO and Either function to
        "EitherT e IO a"
Message-ID:
        <cafvgaswogcuqkzjbt6zexu3czs2wi_somrt7uunzbka0j9r...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Kim-Ee,

If I see a function with the signature ":: IO String" I immediately assume
it is getLine or one of its ilk. Thus the Op's question doesn't seem odd at
all to me. Could you explicate on why you find this very confusing? After
all:

:Prelude> :t getLine
getLine :: IO String

I think you know a lot more about Haskell than I do so I'm curious what the
thinking behind your post was.


Thanks,

Tim


On Wed, Mar 5, 2014 at 10:18 AM, Kim-Ee Yeoh <[email protected]> wrote:

>
> On Thu, Mar 6, 2014 at 12:49 AM, Nathan H?sken 
> <[email protected]>wrote:
>
>> Mmh, I might not have used haskell terminology correctly. Its a function,
>> in the sense of a function of an imperative language ...
>
>
> Yes, you could model IO String in C as a function taking void and
> returning a pointer to char.
>
> Calling an IO String a Haskell function would confuse a lot of people.
>
> -- Kim-Ee
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20140305/7a8b67da/attachment-0001.html>

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

Message: 2
Date: Wed, 5 Mar 2014 15:22:39 -0800
From: David Thomas <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Combining IO and Either function to
        "EitherT e IO a"
Message-ID:
        <cajudvchbx_t6hdjbsuno6oba0pe3eum7hcv7w7bhsrgdz7k...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

It's a function of zero arguments.  It's also sort of, kind of a function
from RealWorld to (String, RealWorld) if you squint.


On Wed, Mar 5, 2014 at 10:18 AM, Kim-Ee Yeoh <[email protected]> wrote:

>
> On Thu, Mar 6, 2014 at 12:49 AM, Nathan H?sken 
> <[email protected]>wrote:
>
>> Mmh, I might not have used haskell terminology correctly. Its a function,
>> in the sense of a function of an imperative language ...
>
>
> Yes, you could model IO String in C as a function taking void and
> returning a pointer to char.
>
> Calling an IO String a Haskell function would confuse a lot of people.
>
> -- Kim-Ee
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20140305/9eac3c5b/attachment-0001.html>

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

Message: 3
Date: Wed, 5 Mar 2014 18:31:07 -0500
From: Brent Yorgey <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] Combining IO and Either function to
        "EitherT e IO a"
Message-ID: <[email protected]>
Content-Type: text/plain; charset=iso-8859-1

In Haskell, the term "function" is reserved for things whose types
include an arrow, ->.  IO String has no -> in it, therefore it is not
a function.  Instead we might call it an "action" or a "procedure".

-Brent

On Wed, Mar 05, 2014 at 03:19:48PM -0800, Tim Perry wrote:
> Kim-Ee,
> 
> If I see a function with the signature ":: IO String" I immediately assume
> it is getLine or one of its ilk. Thus the Op's question doesn't seem odd at
> all to me. Could you explicate on why you find this very confusing? After
> all:
> 
> :Prelude> :t getLine
> getLine :: IO String
> 
> I think you know a lot more about Haskell than I do so I'm curious what the
> thinking behind your post was.
> 
> 
> Thanks,
> 
> Tim
> 
> 
> On Wed, Mar 5, 2014 at 10:18 AM, Kim-Ee Yeoh <[email protected]> wrote:
> 
> >
> > On Thu, Mar 6, 2014 at 12:49 AM, Nathan H?sken 
> > <[email protected]>wrote:
> >
> >> Mmh, I might not have used haskell terminology correctly. Its a function,
> >> in the sense of a function of an imperative language ...
> >
> >
> > Yes, you could model IO String in C as a function taking void and
> > returning a pointer to char.
> >
> > Calling an IO String a Haskell function would confuse a lot of people.
> >
> > -- Kim-Ee
> >
> > _______________________________________________
> > Beginners mailing list
> > [email protected]
> > http://www.haskell.org/mailman/listinfo/beginners
> >
> >

> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners



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

Message: 4
Date: Wed, 5 Mar 2014 18:35:54 -0500
From: Brent Yorgey <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] Combining IO and Either function to
        "EitherT e IO a"
Message-ID: <[email protected]>
Content-Type: text/plain; charset=iso-8859-1

On Wed, Mar 05, 2014 at 03:22:39PM -0800, David Thomas wrote:
> It's a function of zero arguments.

This is really stretching the meaning of the word "function" beyond
any reasonable, useful definition, in my opinion.  See the discussion
here:

  http://conal.net/blog/posts/everything-is-a-function-in-haskell

A much more useful (and precise) point of view is that in Haskell, all
functions take exactly one argument.  Under that view, of course,
there is no such thing as a function of zero arguments.

> It's also sort of, kind of a function
> from RealWorld to (String, RealWorld) if you squint.

I'm don't think this is a very helpful way to understand IO, though it
is probably closer to the sense in which the OP understood IO String
to be a function.

My guess is that what is really going on here is a confusion of
terminology from imperative languages, some of which use the word
"function" for everything, whether they take any arguments or not,
return any values or not, have any side effects or not, etc.

-Brent

> On Wed, Mar 5, 2014 at 10:18 AM, Kim-Ee Yeoh <[email protected]> wrote:
> 
> >
> > On Thu, Mar 6, 2014 at 12:49 AM, Nathan H?sken 
> > <[email protected]>wrote:
> >
> >> Mmh, I might not have used haskell terminology correctly. Its a function,
> >> in the sense of a function of an imperative language ...
> >
> >
> > Yes, you could model IO String in C as a function taking void and
> > returning a pointer to char.
> >
> > Calling an IO String a Haskell function would confuse a lot of people.
> >
> > -- Kim-Ee
> >
> > _______________________________________________
> > Beginners mailing list
> > [email protected]
> > http://www.haskell.org/mailman/listinfo/beginners
> >
> >

> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners



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

Message: 5
Date: Wed, 5 Mar 2014 15:38:45 -0800
From: David Thomas <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Combining IO and Either function to
        "EitherT e IO a"
Message-ID:
        <cajudvchryzy+wdfbeipgk2f_fd_y7eyna2ocn2q0md_8ocu...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Agreed on all counts.


On Wed, Mar 5, 2014 at 3:35 PM, Brent Yorgey <[email protected]> wrote:

> On Wed, Mar 05, 2014 at 03:22:39PM -0800, David Thomas wrote:
> > It's a function of zero arguments.
>
> This is really stretching the meaning of the word "function" beyond
> any reasonable, useful definition, in my opinion.  See the discussion
> here:
>
>   http://conal.net/blog/posts/everything-is-a-function-in-haskell
>
> A much more useful (and precise) point of view is that in Haskell, all
> functions take exactly one argument.  Under that view, of course,
> there is no such thing as a function of zero arguments.
>
> > It's also sort of, kind of a function
> > from RealWorld to (String, RealWorld) if you squint.
>
> I'm don't think this is a very helpful way to understand IO, though it
> is probably closer to the sense in which the OP understood IO String
> to be a function.
>
> My guess is that what is really going on here is a confusion of
> terminology from imperative languages, some of which use the word
> "function" for everything, whether they take any arguments or not,
> return any values or not, have any side effects or not, etc.
>
> -Brent
>
> > On Wed, Mar 5, 2014 at 10:18 AM, Kim-Ee Yeoh <[email protected]> wrote:
> >
> > >
> > > On Thu, Mar 6, 2014 at 12:49 AM, Nathan H?sken <
> [email protected]>wrote:
> > >
> > >> Mmh, I might not have used haskell terminology correctly. Its a
> function,
> > >> in the sense of a function of an imperative language ...
> > >
> > >
> > > Yes, you could model IO String in C as a function taking void and
> > > returning a pointer to char.
> > >
> > > Calling an IO String a Haskell function would confuse a lot of people.
> > >
> > > -- Kim-Ee
> > >
> > > _______________________________________________
> > > Beginners mailing list
> > > [email protected]
> > > http://www.haskell.org/mailman/listinfo/beginners
> > >
> > >
>
> > _______________________________________________
> > Beginners mailing list
> > [email protected]
> > http://www.haskell.org/mailman/listinfo/beginners
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20140305/5cd4bee6/attachment-0001.html>

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

Message: 6
Date: Thu, 6 Mar 2014 11:06:36 +0100
From: Daniel Trstenjak <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Using GHCi, import submodule that
        needs to import another submodule?
Message-ID: <20140306100636.GA3194@machine>
Content-Type: text/plain; charset=utf-8


Hi James,

> One observation I could make as a beginner is that I wish the
> documentation made a better distinction between packages and modules.

Unfortunately it's even a bit more complex. 

First of all there're the cabal packages which contain your haskell
source files which define the modules.

These cabal packages are build and installed by cabal and result into
ghc packages, which are some kind of binary blob (I don't know the details)
that contains all your modules in a compiled form, and these packages
are readable by ghc/ghci.

So 'import' refers to the modules of the ghc packages and ':load' refers
to the modules in the source files.

> 2.4.5.1. :module and :load I?d love to get a clear definition of ?loaded" vs 
> "in scope".

':load' is pretty much the same as loading a package and importing a
module from it, so ':load' does both at once.

Everything that's imported is in scope.


> Does import only bring a module into scope, not load it?

You've to load something before you can bring it with import into scope.


> Then would installed packages be considered loaded but not in scope?

I think that ghci only loads and imports the packages defining the Prelude 
module at startup.
All other packages are loaded lazily if you're importing a module of them.


> Using :load loads them and also places them in scope?

Yes.


> Using :modules -m would remove a module from scope but it would still be 
> loaded?

I think so for ghc package modules, but I'm not sure for modules loaded with 
':load',
they might get unloaded again, but even if not, I don't think that you could 
get them back
in scope by using 'import'.


Greetings,
Daniel


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

Subject: Digest Footer

_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners


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

End of Beginners Digest, Vol 69, Issue 13
*****************************************

Reply via email to