Edward Amsden schrieb:
Aditya: Not quite, because I'm actually looking to extract values from
a functor (Maybe) with a default.
Stephen: Thanks, I'll take a look at those. I do have a need for it.
I'm writing a very similar library to Yampa. (I would be patching
Yampa, but the code is a
Hello all:
I'd like to right a function that could take a structure with type
(random example):
(Int, (String, (Int, Int)))
and another where each individual value is a Maybe of the
corresponding type, for example:
(Maybe Int, (Maybe String, (Maybe Int, Maybe Int)))
and perform a fromMaybe
Maybe something like this would work for you (requires the TypeFamilies
extension).
class FromMaybe a where
type Maybe' a
fromMaybe :: a - Maybe' a - a
instance FromMaybe Int where
type Maybe' Int = Maybe Int
fromMaybe = Data.Maybe.fromMaybe
instance
On 28 December 2010 19:23, Edward Amsden eca7...@cs.rit.edu wrote:
Hello all:
I'd like to right a function that could take a structure with type
(random example):
(Int, (String, (Int, Int)))
and another where each individual value is a Maybe of the
corresponding type, for example:
(Maybe
Although I don't understand it myself Oleg's deepest functor [1] seems
to be what you're looking for.
-deech
[1] http://okmij.org/ftp/Haskell/deepest-functor.lhs
On Tue, Dec 28, 2010 at 1:23 PM, Edward Amsden eca7...@cs.rit.edu wrote:
Hello all:
I'd like to right a function that could take a
On Tue, Dec 28, 2010 at 21:23, Edward Amsden eca7...@cs.rit.edu wrote:
(Int, (String, (Int, Int)))
and another where each individual value is a Maybe of the
corresponding type, for example:
(Maybe Int, (Maybe String, (Maybe Int, Maybe Int)))
This example demonstrates exactly why you might
Aditya: Not quite, because I'm actually looking to extract values from
a functor (Maybe) with a default.
Stephen: Thanks, I'll take a look at those. I do have a need for it.
I'm writing a very similar library to Yampa. (I would be patching
Yampa, but the code is a mess, so I decided to try
Basically, I have a signal processing loop, where values are passed
updated with a Maybe, representing whether there is or is not a change
to the value. I could use a single Maybe around the whole thing, but
that would require then re-updating a potentially large structure
entirely. I want to
On 28 December 2010 21:44, Edward Amsden eca7...@cs.rit.edu wrote:
[SNIP]
I'm writing a very similar library to Yampa. (I would be patching
Yampa, but the code is a mess, so I decided to try starting from
scratch.)
Basically, I have a signal processing loop, where values are passed
updated