>
> In that sense every value in maths is a function. In other words: Your
> extension of everything (!) to functions is redundant.
>
And function is not unique in this way. All types can be embedded into
pairs also, e.g., newtype MyInt = MyInt ((),Int), or newtype MyInt = MyInt
(((),Int),()), et
On Sat, Dec 31, 2011 at 11:09 PM, Kevin Quick wrote:
>> varElem :: forall x . (Show x) => Var -> x
>> varElem (V1 x) = x
>> varElem (V2 x) = x
>>
>> main = putStrLn . elemStr . varElem $ test
>
The problem here is that you want the return type to depend on the
'value' of Var,
which is not known u
Yves Parès wrote:
> But still, I maintain my previous view. I could clarify that by saying
> that (e.g. for Maybe) we could separate it in two types, Maybe itself
> and its monad:
>
> -- The plain Maybe type
> data Maybe a = Just a | Nothing
>
> -- The MaybeMonad
> newtype MaybeMonad a = MM ( ()
On 31/12/2011 13:18, Yves Parès wrote:
But still, I maintain my previous view. I could clarify that by saying
that (e.g. for Maybe) we could separate it in two types, Maybe itself
and its monad:
-- The plain Maybe type
data Maybe a = Just a | Nothing
-- The MaybeMonad
newtype MaybeMonad a = M
On Sat, 31 Dec 2011 08:50:05 -0700, Stephen Tetley
wrote:
Maybe you want a deconstructor (sometime called an eliminator)?
deconsVar :: (Maybe Int -> a) -> (Maybe String -> a) -> Var -> a
deconsVar f g (V1 a) = f a
deconsVar f g (V2 b) = g b
That works and has the advantage of allowing a si
Maybe you want a deconstructor (sometime called an eliminator)?
deconsVar :: (Maybe Int -> a) -> (Maybe String -> a) -> Var -> a
deconsVar f g (V1 a) = f a
deconsVar f g (V2 b) = g b
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.hask
I'm having some difficulty avoiding a tight parametric binding of function
parameters, which is limiting the (de)composability of my expressions.
I'm curious as to whether there is an option or method I haven't tried to
achieve this.
Here's an example test case:
data Var = V1 (Maybe Int)
On Dec 31, 2011 8:19 AM, "Yves Parès" wrote:
> -- The plain Maybe type
> data Maybe a = Just a | Nothing
>
> -- The MaybeMonad
> newtype MaybeMonad a = MM ( () -> Maybe a )
>
> That's what using Maybe as a monad semantically means, doesn't it?
I'd have to say no. That Maybe types are isomorphic
Thanks for the explanation on free monads, it's interesting.
But still, I maintain my previous view. I could clarify that by saying that
(e.g. for Maybe) we could separate it in two types, Maybe itself and its
monad:
-- The plain Maybe type
data Maybe a = Just a | Nothing
-- The MaybeMonad
newty
* Yves Parès [2011-12-31 13:09:37+0100]
> One thought occur to me recently when explaining the concept of Monad to
> non-haskellers: internally, all standard Monads are newtypes wrapping
> functions:
> StateT is, WriterT is, ContT is. Even IO and ST are, both conceptually and
> in their implementa
Maybe and [] have still the same meaning: they can be seen as functions:
- they represent the result(s) that might or might not have a computation
- *they have to be called/ran/executed* (wichever term you prefer) through
Data.Maybe.maybe or Data.List.foldX, so that we can extract some value out
of
On 31 December 2011 12:26, Jerzy Karczmarczuk
wrote:
> Yves Parès :
>
>> all standard Monads are newtypes wrapping functions
>
> What about Maybe and [] ?
And Identity ...
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/ma
Yves Parès :
all standard Monads are newtypes wrapping functions
What about Maybe and [] ?
Jerzy Karczmarczuk
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Hello Café,
One thought occur to me recently when explaining the concept of Monad to
non-haskellers: internally, all standard Monads are newtypes wrapping
functions:
StateT is, WriterT is, ContT is. Even IO and ST are, both conceptually and
in their implementation by GHC.
ParsecT (not part of mtl,
14 matches
Mail list logo