Re: Is it possible such Monad? (Baa)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Is it possible such Monad? (Baa)

鲍凯文
Hi,

1. I think your data type is isomorphic to

data Allpass w m a = Pass Bool (m a) w

2. Maybe first try to write a Functor instance? Then you can find out what constraints are necessary for 'w' and 'm' to write it.

3. What does this data type intend to represent?

Best,

toz 

On Wed, Oct 25, 2017 at 5:32 AM <[hidden email]> wrote:
Send Beginners mailing list submissions to
        [hidden email]

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
        [hidden email]

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

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


Today's Topics:

   1.  Is it possible such Monad? (Baa)


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

Message: 1
Date: Wed, 25 Oct 2017 13:56:31 +0300
From: Baa <[hidden email]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[hidden email]>
Subject: [Haskell-beginners] Is it possible such Monad?
Message-ID: <20171025135631.1f9913d2@Pavel>
Content-Type: text/plain; charset=US-ASCII

Hello All!

Is it possible to write Monad for such type:

  data Allpass w m a = Nopass (m a) w | Allpass (m a) w

I can write (>>=), IMHO such type can not be Monad due to `w` is not
under `m` monad, right?


===
Best regards, Paul


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

Subject: Digest Footer

_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners


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

End of Beginners Digest, Vol 112, Issue 22
******************************************

_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
Baa
Reply | Threaded
Open this post in threaded view
|

Re: Is it possible such Monad? (Baa)

Baa
Primary idea was to keep error messages. OK, I done it with `State`
monad :)

Thank you!

> Hi,
>
> 1. I think your data type is isomorphic to
>
> data Allpass w m a = Pass Bool (m a) w
>
> 2. Maybe first try to write a Functor instance? Then you can find out
> what constraints are necessary for 'w' and 'm' to write it.
>
> 3. What does this data type intend to represent?
>
> Best,
>
> toz
>
> On Wed, Oct 25, 2017 at 5:32 AM <[hidden email]> wrote:
>
> > Send Beginners mailing list submissions to
> >         [hidden email]
> >
> > 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
> >         [hidden email]
> >
> > You can reach the person managing the list at
> >         [hidden email]
> >
> > When replying, please edit your Subject line so it is more specific
> > than "Re: Contents of Beginners digest..."
> >
> >
> > Today's Topics:
> >
> >    1.  Is it possible such Monad? (Baa)
> >
> >
> > ----------------------------------------------------------------------
> >
> > Message: 1
> > Date: Wed, 25 Oct 2017 13:56:31 +0300
> > From: Baa <[hidden email]>
> > To: The Haskell-Beginners Mailing List - Discussion of primarily
> >         beginner-level topics related to Haskell
> > <[hidden email]> Subject: [Haskell-beginners] Is it possible
> > such Monad? Message-ID: <20171025135631.1f9913d2@Pavel>
> > Content-Type: text/plain; charset=US-ASCII
> >
> > Hello All!
> >
> > Is it possible to write Monad for such type:
> >
> >   data Allpass w m a = Nopass (m a) w | Allpass (m a) w
> >
> > I can write (>>=), IMHO such type can not be Monad due to `w` is not
> > under `m` monad, right?
> >
> >
> > ===
> > Best regards, Paul
> >
> >
> > ------------------------------
> >
> > Subject: Digest Footer
> >
> > _______________________________________________
> > Beginners mailing list
> > [hidden email]
> > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
> >
> >
> > ------------------------------
> >
> > End of Beginners Digest, Vol 112, Issue 22
> > ******************************************
> >  

_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners