[Haskell-cafe] Monadic correctness

2009-10-17 Thread Andrew Coppin
Suppose we have newtype Foo x instance Monad Foo runFoo :: Foo x -> IO x What sort of things can I do to check that I actually implemented this correctly? I mean, ignoring what makes Foo special for a moment, how can I check that it works correctly as a monad. _

Re: [Haskell-cafe] Monadic correctness

2009-10-17 Thread Edward Z. Yang
Excerpts from Andrew Coppin's message of Sat Oct 17 15:21:28 -0400 2009: > Suppose we have > >newtype Foo x >instance Monad Foo >runFoo :: Foo x -> IO x > > What sort of things can I do to check that I actually implemented this > correctly? I mean, ignoring what makes Foo special for

Re: [Haskell-cafe] Monadic correctness

2009-10-17 Thread David Menendez
On Sat, Oct 17, 2009 at 3:21 PM, Andrew Coppin wrote: > Suppose we have > >  newtype Foo x >  instance Monad Foo >  runFoo :: Foo x -> IO x > > What sort of things can I do to check that I actually implemented this > correctly? I mean, ignoring what makes Foo special for a moment, how can I > chec

Re: [Haskell-cafe] Monadic correctness

2009-10-17 Thread Andrew Coppin
Edward Z. Yang wrote: Excerpts from Andrew Coppin's message of Sat Oct 17 15:21:28 -0400 2009: Suppose we have newtype Foo x instance Monad Foo runFoo :: Foo x -> IO x What sort of things can I do to check that I actually implemented this correctly? I mean, ignoring what makes Foo

Re: [Haskell-cafe] Monadic correctness

2009-10-17 Thread Derek Elkins
On Sat, Oct 17, 2009 at 3:24 PM, Andrew Coppin wrote: > Edward Z. Yang wrote: >> >> Excerpts from Andrew Coppin's message of Sat Oct 17 15:21:28 -0400 2009: >> >>> >>> Suppose we have >>> >>>   newtype Foo x >>>   instance Monad Foo >>>   runFoo :: Foo x -> IO x >>> >>> What sort of things can I d

Re: [Haskell-cafe] Monadic correctness

2009-10-17 Thread Andrew Coppin
Derek Elkins wrote: On Sat, Oct 17, 2009 at 3:24 PM, Andrew Coppin wrote: I'm reasonably confident it works, but not 100% sure... newtype Foo x = Foo (M -> IO x) In this case it is trivial, Foo = ReaderT M IO which is a monad. Ah yes, of course... I keep forgetting that the Reader

Re: [Haskell-cafe] Monadic correctness

2009-10-17 Thread Daniel Fischer
Am Samstag 17 Oktober 2009 22:24:08 schrieb Andrew Coppin: > Edward Z. Yang wrote: > > Excerpts from Andrew Coppin's message of Sat Oct 17 15:21:28 -0400 2009: > >> Suppose we have > >> > >>newtype Foo x > >>instance Monad Foo > >>runFoo :: Foo x -> IO x Are you sure that's really the

Re: [Haskell-cafe] Monadic correctness

2009-10-17 Thread Andrew Coppin
Daniel Fischer wrote: Am Samstag 17 Oktober 2009 22:24:08 schrieb Andrew Coppin: Edward Z. Yang wrote: Excerpts from Andrew Coppin's message of Sat Oct 17 15:21:28 -0400 2009: Suppose we have newtype Foo x instance Monad Foo runFoo :: Foo x -> IO x Are you s