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. retreive a list of installed packages (harry)
2. Is Cons in the Haskell Module Library (Patrick Lynch)
3. Re: Is Cons in the Haskell Module Library (Nadir Sampaoli)
4. Re: Is Cons in the Haskell Module Library (Vikraman)
5. Re: Is Cons in the Haskell Module Library (Brandon Allbery)
6. Re: Constrained polymorphic functions as natural
transformations (Brent Yorgey)
7. Re: retreive a list of installed packages (Brent Yorgey)
8. Re: Is Cons in the Haskell Module Library (Brent Yorgey)
----------------------------------------------------------------------
Message: 1
Date: Sun, 22 Dec 2013 14:38:53 +0000 (UTC)
From: harry <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] retreive a list of installed packages
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii
Is there any simple way for a program to retrieve a list of installed
packages (such as ghc-pkg list returns), or would it be easier to execute
phc-pkg as an external process and catch the output?
------------------------------
Message: 2
Date: Sun, 22 Dec 2013 12:23:42 -0500
From: "Patrick Lynch" <[email protected]>
To: <[email protected]>
Subject: [Haskell-beginners] Is Cons in the Haskell Module Library
Message-ID: <869634CA9D1B4FF2A8ED6BB20D4A013E@UserPC>
Content-Type: text/plain; charset="iso-8859-1"
Good morning,
I'm going through Graham Hutton's link on Category Theory [and yes I understand
that you needn't study CT in order to use Haskell] and he uses Cons.
I realize that Cons may be a synonym for ':'.
But can someone tell me how to search the Haskell Library to find the module
containing Cons?
Thank you and Merry Christmas
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20131222/ec3cb0c0/attachment-0001.html>
------------------------------
Message: 3
Date: Sun, 22 Dec 2013 18:38:45 +0100
From: Nadir Sampaoli <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Is Cons in the Haskell Module Library
Message-ID:
<CAFYwTdQzsHmE9F1LPc_dAuhYzTnY37cyRo8bc6D761d401Ab=a...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8
Hello Patrick,
> But can someone tell me how to search the Haskell Library to find the module
> containing Cons?
I (sadly) know nothing about Category Theory, so I probably am missing
something, but when I'm looking for the module where a function or
data type belongs to, I usually use Hoogle:
http://www.haskell.org/hoogle/ (there's a hoogle command-line tool
too).
Is it what you're after?
On a side note I tend to assimilate lisp's cons to Haskell's (:) too.
I wouldn't mind if someone corrects this view of mine in case it's not
correct :)
Regards,
Nadir
------------------------------
Message: 4
Date: Sun, 22 Dec 2013 23:10:47 +0530
From: Vikraman <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Is Cons in the Haskell Module Library
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"
On Sun, Dec 22, 2013 at 12:23:42PM -0500, Patrick Lynch wrote:
> Good morning,
> I'm going through Graham Hutton's link on Category Theory [and yes I
> understand that you needn't study CT in order to use Haskell] and he uses
> Cons.
> I realize that Cons may be a synonym for ':'.
> But can someone tell me how to search the Haskell Library to find the module
> containing Cons?
> Thank you and Merry Christmas
Cons is (:) and is defined in GHC.Types.
?> :i (:)
data [] a = ... | a : [a] -- Defined in `GHC.Types'
infixr 5 :
You could also try hoogle.
http://www.haskell.org/hoogle/?hoogle=cons
--
Vikraman
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 230 bytes
Desc: PGP signature
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20131222/8b148b77/attachment-0001.sig>
------------------------------
Message: 5
Date: Sun, 22 Dec 2013 12:51:13 -0500
From: Brandon Allbery <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Is Cons in the Haskell Module Library
Message-ID:
<cakfcl4xpk_-3_nfg0ykrmtljfpze_h6dn-og5sm4pgjrft8...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
On Sun, Dec 22, 2013 at 12:23 PM, Patrick Lynch <[email protected]>wrote:
> Good morning,
> I'm going through Graham Hutton's link on Category Theory [and yes I
> understand that you needn't study CT in order to use Haskell] and he uses
> Cons.
> I realize that Cons may be a synonym for ':'.
> But can someone tell me how to search the Haskell Library to find the
> module containing Cons?
>
The usual point of Cons is that it's instructive to reconstruct the list
type from first principles. You would never do this in a real program,
since it's exactly the same as the built-in list type --- except that it
doesn't come with all the predefined list stuff, so it's easier for you to
build it yourself without interfering with (or being interfered with by!)
the standard library. It also doesn't come with the convenient syntactic
sugar. And even if for some reason you did need to restrict lists that way
in a real program, you would probably use a newtype instead so that you can
still use the standard list operations and syntax after unwrapping.
data List a = Nil | Cons a (List a)
data [] a = [] | (:) a ([] a) -- the builtin list type, for
comparison
--
brandon s allbery kf8nh sine nomine associates
[email protected] [email protected]
unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20131222/44e44737/attachment-0001.html>
------------------------------
Message: 6
Date: Sun, 22 Dec 2013 15:26:50 -0500
From: Brent Yorgey <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Constrained polymorphic functions as
natural transformations
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii
Hi Matt,
On Fri, Dec 13, 2013 at 03:25:03PM +0000, Matt R wrote:
>
> Note that you can't always characterize a type class by a single
> > function like this. For example, consider class Foo ... There is no way
> > to pick functors f and g such that a Foo dictionary is
> > equivalent to f a -> g a.
> >
>
> I was wondering why the following wouldn't do the trick?
>
> sig :: Foo a => Either Int a -> Either a Int
> sig (Left n) = Left (bar n)
> sig (Right a) = Right (baz a)
You have encoded a Foo dictionary as an Either Int a -> Either a Int
function, but that is very different than saying that having a Foo
dictionary is *equivalent* to having an Either Int a -> Either a Int
function. They are not equivalent; in particular, you could have a
function which sends Left 5 to Right 6, which does not correpond to
anything in Foo. Put another way, if you try to write a Foo instance
given only some unknown function of type (Either Int a -> Either a
Int), you will find that you cannot do it. So my point stands that it
is not always possible to *characterize* a type class as a natural
transformation.
> > This doesn't really make sense. If a natural transformation
> > consists of a family of arrows which all live in Hask_T,
>
>
> In this case, I think the family of arrows lives in Hask -- we can
> reinterpret our Hask endofunctors as instead being functors from Hask_T ->
> Hask. Then there's no requirement on our constrained polymorphic functions
> to commute with sig.
>
> In your example function f, the two functors would be the identify functor
> "Id" and a constant functor "K Foo", and naturality is just saying that,
> for any function g: A -> B that satisfies show == show . f, then:
>
> f = f . g
>
> Which is clearly true for f.
Hmm, yes, this seems plausible.
> Am I still barking up the wrong tree? Apologies if so, but it *feels* like
> there should be something here, with the intuition that:
>
> Functions that don't "inspect" their values ==> you can substitute values
> without fundamentally affecting the action of the function ==> natural
> transformations between Hask endofunctors.
>
> Functions that don't inspect their values other than through a particular
> interface T ==> you can substitute values without fundamentally affecting
> the action of the function, providing your substitution is invisible
> through the interface T ==> Natural transformations between functors Hask_T
> -> Hask.
Yes, makes sense I think.
-Brent
------------------------------
Message: 7
Date: Sun, 22 Dec 2013 15:35:24 -0500
From: Brent Yorgey <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] retreive a list of installed packages
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii
On Sun, Dec 22, 2013 at 02:38:53PM +0000, harry wrote:
> Is there any simple way for a program to retrieve a list of installed
> packages (such as ghc-pkg list returns), or would it be easier to execute
> phc-pkg as an external process and catch the output?
Try the hackage-db package:
http://hackage.haskell.org/package/hackage%2Ddb
-Brent
------------------------------
Message: 8
Date: Sun, 22 Dec 2013 15:38:42 -0500
From: Brent Yorgey <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] Is Cons in the Haskell Module Library
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii
On Sun, Dec 22, 2013 at 12:23:42PM -0500, Patrick Lynch wrote:
> Good morning,
> I'm going through Graham Hutton's link on Category Theory [and yes I
> understand that you needn't study CT in order to use Haskell] and he uses
> Cons.
> I realize that Cons may be a synonym for ':'.
> But can someone tell me how to search the Haskell Library to find the module
> containing Cons?
> Thank you and Merry Christmas
Are you asking how to find the definition of (:) in Haskell? (It is
special built-in syntax.) Or are you asking how to find out what
Graham Hutton means by 'Cons'? In the latter case, you will have to
tell us exactly where in his notes to look, because out of context it
is impossible to tell.
-Brent
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 66, Issue 14
*****************************************