Re: [Haskell-beginners] 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
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-request@haskell.org
You can reach the person managing the list at beginners-owner@haskell.org
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
To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell 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 Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 112, Issue 22 ******************************************

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
wrote: 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-request@haskell.org
You can reach the person managing the list at beginners-owner@haskell.org
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
To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell 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 Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 112, Issue 22 ******************************************
participants (2)
-
Baa
-
鲍凯文