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.  How to best handle classes of types, interactions and
      listing of different types? (Silent Leaf)
   2. Re:  How to best handle classes of types, interactions and
      listing of different types? (Silent Leaf)
   3. Re:  How to best handle classes of types, interactions and
      listing of different types? (Imants Cekusins)
   4.  All About Monads (Cezar Elnazli)
   5. Re:  All About Monads (Imants Cekusins)


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

Message: 1
Date: Mon, 23 May 2016 18:06:52 +0200
From: Silent Leaf <silent.le...@gmail.com>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <beginners@haskell.org>
Subject: [Haskell-beginners] How to best handle classes of types,
        interactions and listing of different types?
Message-ID:
        <cagfccjm2p2zj6so+vpahraqqfi0tkfodrqtqf2urz2bddyc...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Hi! I'm still studying the theory of Haskell, but i also wanted to start
dabbling with guideless coding, all by myself, and it happens experience is
just as much important as theoretical knowledge! I'm not surprise mind you
:P

Say there's a class, many types that can instantiate it. Then, i in fact
need to be able to concatenate (mappend would be ideal!), make lists of
values of different types, all instantiating the class.

I'm a bit lost on this. There are at least two sorts of ways to handle said
group of types, but i'm not certain either is best, and i'm not even very
much satisfied about either. Plus they don't specifically differ as regards
handling of listing or otherwise interacting *between* different instances
of the same class (or alternately, different types born from the same Type
constructor).

First idea i had, was based on making a class indeed, as well i just love
this type of polymorphism (visavis other paradigms). Each type would only
have to instantiate the key metshods, and no need of wrappers to use said
methods, so on this respect it's pretty great.
However, as soon as we want operations between values of different types,
it rather gets tricky.
The only way i know of to make a heterogeneous list is to use
ExistentialQuantificators, create a newtype (or data?) wrapper for the
class, allowing for any type to be in, without parameters.
Now, the problem i have with this, is the wrapping: if i wanna make a list
of types, i gotta wrap all values, and if this list becomes member of a
superlist of the same polymorphic type, i gotta wrap this very sublist
again with the "class wrapper". Maybe i'm imagining problems and i won't
actually need to touch too much to the wrapping if i write the correct
functions or instances, but from where i am, permanent wrapping seems
tiresome, very much in fact removes the purpose of a class: to allow
polymorphic functions without need to wrap the types of inputs/outputs
inside a newtype.

Which lead me to the second solution: forget the class, and make a type
constructor that basically gets a list of key-methods and one field for the
wrapped type. Basically it amounts to OOP, at least it seems so. I'm not
really a big fan of the thing, and eventually i realized it wouldn't help
me more visavis trans-type methods, especially an idea of one or more
monoidal instances for the class, or the type constructor that replaces it.
(Actually I'm not wholly certain as of how I'm supposed to handle Type
constructors instead of classes, as I only know how to make heterogeneous
out of a class, not out of a type constructor, even if its polymorphic
key-methods are fields included in it. (hope i'm being clear enough, don't
hesitate telling me otherwise!)

So, as I'm kinda beginner as regards actual coding, i'm asking advice on
the subject. Maybe the problem is in how i look at the problem, and I
shouldn't even be there trying to do what i try to do. Any alternative
solution or viewpoint is heartily welcome!
I resume my problem once more: how to handle cross-type interactions and
grouping when they only have a class in common, and if possible without
having to use ExistentialQuantificators, unless there's a way to keep the
wrappers far away, invisible, automatic.

Thanks a lot in advance! (Ideas of specialized tutorials are also very much
welcome!)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20160523/a743d063/attachment-0001.html>

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

Message: 2
Date: Mon, 23 May 2016 18:21:30 +0200
From: Silent Leaf <silent.le...@gmail.com>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <beginners@haskell.org>
Subject: Re: [Haskell-beginners] How to best handle classes of types,
        interactions and listing of different types?
Message-ID:
        <CAGFccjMr7Wu36av4H4ZseJwFV9h=NqRsFC3dTzgn1YKa95=-l...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

By the way if anyone knows the price on performances and any other
technical or non-obvious price that one must pay while using
ExistentialQuantificators, esp to make heterogeneous types then lists? On
the subject of all those half-extensions half-hacks (?) i sometimes really
hesitate, fearing some optimisations will suddenly disappear just because
of one or two bad uses of those extensions or another.

In fact with my problem i have the distinct intuition that it seems really
absurd to have to use extensions of the basic haskell just to solve a
situation that to me seems very possibly usual, or at least far from rare.
I keep thinking I took the problem wrongly, or I'm just not seeking to do
the right thing, but so far zippo...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20160523/02a1cd74/attachment-0001.html>

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

Message: 3
Date: Mon, 23 May 2016 22:03:53 +0200
From: Imants Cekusins <ima...@gmail.com>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <beginners@haskell.org>
Subject: Re: [Haskell-beginners] How to best handle classes of types,
        interactions and listing of different types?
Message-ID:
        <cap1qinb1n+qbturkb8ej+5ymfu4_6qe4ldzlz-2rzanumjv...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

for me a rule of thumb for choosing features / extensions is: if I see
compiler errors, I should understand them and know how to fix them.
?
Parameterized types, type sinonyms, records and classes with as few
extensions as possible are pretty much all I use, type wise. You can do a
lot with them alone.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20160523/b5d9c7de/attachment-0001.html>

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

Message: 4
Date: Mon, 23 May 2016 23:26:27 +0300
From: Cezar Elnazli <cezar.elnaz...@gmail.com>
To: beginners@haskell.org
Subject: [Haskell-beginners] All About Monads
Message-ID: <469c3c72-7abf-4b8f-b676-c4d3771e4...@gmail.com>
Content-Type: text/plain; charset=us-ascii

Hello,

I am currently going through "All About Monads" on the Haskell Wiki. I see that
it also has a Github repository[1]. However, the repository seems outdated to
the point where the Makefile no longer works (I was not able to build the wiki),
some (if not most) of the examples no longer compile, or they do so with 
warnings
(e.g. example12.hs), and even the formatting of the published article on the 
wiki
seems broken.

What I'm asking is if the repository I mentioned is the correct one, and if it
makes any sense to send a pull request or if it is worth the effort to fork it
and update the code.

Thanks!

[1]: https://github.com/dag/all-about-monads



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

Message: 5
Date: Mon, 23 May 2016 22:40:43 +0200
From: Imants Cekusins <ima...@gmail.com>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <beginners@haskell.org>
Subject: Re: [Haskell-beginners] All About Monads
Message-ID:
        <cap1qinad8j-djwxt8xaqaco4twhx8g9g6bo3tgc7m_ub8dj...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

https://wiki.haskell.org/All_About_Monads
says:

If you wish to help out you should fork this GitHub repo
<https://github.com/dag/all-about-monads> rather than edit this page, for
now.
?
or you could add issues here:
https://github.com/dag/all-about-monads/issues
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20160523/944276fc/attachment-0001.html>

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

Subject: Digest Footer

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


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

End of Beginners Digest, Vol 95, Issue 29
*****************************************

Reply via email to