John Smith wrote:
> I would like to formally propose that Monad become a subclass of
> Applicative, with a call for consensus by 1 February.
I would prefer that we have some proposal like class aliases implemented
before we start fundamental restructuring of basic type classes. This
would help to
I would like to formally propose that Monad become a subclass of Applicative, with a call for consensus by 1 February.
The change is described on the wiki at http://haskell.org/haskellwiki/Functor-Applicative-Monad_Proposal, and ticketed
at http://hackage.haskell.org/trac/ghc/ticket/4834.
As
Dan Doel wrote:
What do I have to import to get the Functor ((,) a) instance?
(Of course, I can define it myself, but this is not the point.)
In GHC 6.6 and above, you'll need to import Control.Monad.Instances (a bit of
a weird place to put it, but I guess there's no Control.F
On Wednesday 19 September 2007, Janis Voigtlaender wrote:
> Hi,
>
> the Prelude docs found via
>
> http://haskell.org/hoogle/hoodoc.cgi?module=Prelude&name=Functor&mode=class
>
> claim that there is an instance
>
> Functor ((,) a)
>
> And yet, I get (in
Hi,
the Prelude docs found via
http://haskell.org/hoogle/hoodoc.cgi?module=Prelude&name=Functor&mode=class
claim that there is an instance
Functor ((,) a)
And yet, I get (in GHC, but similarly in Hugs):
Prelude> fmap (+1) (undefined,2)
:1:0:
No instance for (Fun
I've been running into a problem where I'd like to modify a container type
based on a body of existing code to be a Functor. A difficulty seems to be
that parts of the container type are based on a type constructor where the
underlying type 'a' over which "fmap :: (a
You can also export the type without exporting the constructors. That
way "import"ers can use the type in type signatures and instance
declarations while still not being able to use anything but the
exported interface.
E.g. instead of
Module Set
( emptySet
, makeSet
At 13:15 2002-01-22 -0500, Hongwei Xi wrote:
><...>
>In Haskell, I guess that the one implemented later is always chosen.
>Why can't I have two different implementations for an interface?
Actually, I can't think of situations where I would desire this.
Could you please give an example?
>Another
Eq c) => (b->c) -> a b -> a c
>>
>>data MyList a = MyList [a] deriving Show
>>
>>instance Container MyList where
>> celem x (MyList l) = elem x l
>> cmap f (MyList l) = MyList (map f l)
>>\end{code}
>>
>>What does ML struct/fu
yList where
celem x (MyList l) = elem x l
cmap f (MyList l) = MyList (map f l)
\end{code}
What does ML struct/functor have anything
better than type classes ? For the user type
classes feels like implicit functor istantiations
to specific sturucture, and struct/functor seems
just bugglling the u
Wolfgang Jeltsch wrote (on 29-10-01 23:43 +0100):
> you cannot use sections with types and (->). Furthermore the variable must
> begin with a lowercase letter. So you have to write
> instance Functor (->) a where.
Erp, I said that the Functor class has arity *. Actually, it h
Wolfgang Jeltsch wrote (on 29-10-01 23:43 +0100):
> you cannot use sections with types and (->). Furthermore the variable must
> begin with a lowercase letter. So you have to write
> instance Functor (->) a where.
Actually, you have to write:
instance Functor ((->) a)
Hi,
you cannot use sections with types and (->). Furthermore the variable must
begin with a lowercase letter. So you have to write
instance Functor (->) a where.
By the way, you may write
fmap = (.)
instead of
fmap f g = f . g.
Yours, Wo
hi,
i am not sure whether this is the right place.
i have a question about the instance of Functor, the following segmantation couldn't
be compiled by ghc, any clue?
instance Functor (A->) where
map f g = f . g
TIA!Get your FREE
> What is wrong with:
>
> class Functor ConstInt where
> map f (Const n) = Const n
Ups - absolutely nothing.
I actually tried it with
data ConstInt a = Int
and didnt manage to make this an instance of
class Functor. Sorry for giving the wrong
example.
-Tobi
-
I am trying to make all polynomial functors (in the
categorical sense) an instance of the class Functor.
Consider a datatype (corresponsing to a constant functor):
data ConstInt a = Const Int
ConstInt is clearly a functor in the categorical sense,
but is 'ConstInt' also a functor
some more insight on this question. (If the Haskell list had a
FAQ, this would surely be on it by now!):
http://www.mail-archive.com/haskell@haskell.org/msg05356.html
(Thanks to Sven Panne who posted this URL in a previous message)
| I'm stuck. I'd like to do this:
|
| in
nts, but has been given 2
> > When checking kinds in `Func2 a b'
> > When checking kinds in `Functor (Func2 a b)'
>
> So I guess GHC only accepts type synonyms as instances when the kind of
> the class is *.
The actual restriction is that type synonyms must a
For strange reasons I won't get into here, I would like to implement an
instance of the Functor class for various function types with 1 or more
arguments. I want fmap to transform the result of the function, as
opposed to transforming the first argument.
Once I figured out the syntax
>Is anyone else working on Generic Haskell.
Yes, I have an MSc student (Jan de Wit) who will work on Generic Haskell,
and I expect more people will start working on it in Utrecht later this year.
Johan
| The (or at least, my) hope is that there will be an
| extension to Haskell soon (called "Generic Haskell") which
| will make this easy to do.
Indeed, Ralf Hinze and I are working on a Haskell workshop
paper on this very topic, and I hope that a summer intern,
Andrei Serjantov, will be able to
Kuncak wrote:
| Why don't we have "deriving Functor" in Haskell?
Tom Pledger answered:
| I don't know how significant this is, but types
| declared as Functor instances have kind (*->*),
| whereas types with any derived instances have kind *.
This might be th
Kuncak writes:
> Why don't we have "deriving Functor" in Haskell?
>
> Functor is in Prelude, so it could be known to the compiler.
> I am aware that one does not write modular interpreter every day,
> but I think that turning a type constructor into functor
Why don't we have "deriving Functor" in Haskell?
Functor is in Prelude, so it could be known to the compiler.
I am aware that one does not write modular interpreter every day,
but I think that turning a type constructor into functor is something
which is done quite often.
At 09:13 +0300 1998/11/16, S.D.Mechveliani wrote:
>> In the Prelude
>> ~~~
>>
>> class Functor f where
>> fmap :: (a -> b) -> f a -> f b
>
>
>What about renaming it, say, to Mappable f ?
>
>It looks l
Simon Peyton-Jones <[EMAIL PROTECTED]> writes
> We're nearly done with Haskell 98.
> ...
> In the Prelude
> ~~~
>
> class Functor f where
> fmap :: (a -> b) -> f a -> f b
What about renaming it, say, to Mappa
26 matches
Mail list logo