Re: [Haskell] Functor => Applicative => Monad

2010-12-14 Thread Sittampalam, Ganesh
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

[Haskell] Functor => Applicative => Monad

2010-12-14 Thread John Smith
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

Re: [Haskell] Functor ((,) a)

2007-09-19 Thread Janis Voigtlaender
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

Re: [Haskell] Functor ((,) a)

2007-09-19 Thread Dan Doel
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

[Haskell] Functor ((,) a)

2007-09-19 Thread Janis Voigtlaender
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

Functor instance for arbitrary polymorphic types

2003-06-10 Thread Graham Klyne
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

Re: type class VS struct/functor

2002-01-23 Thread Mike Gunter
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

Re: type class VS struct/functor

2002-01-23 Thread Rijk-Jan van Haaften
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

Re: type class VS struct/functor

2002-01-22 Thread Hongwei Xi
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

type class VS struct/functor

2002-01-18 Thread 안기영
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

Re: functor

2001-10-30 Thread Frank Atanassow
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

Re: functor

2001-10-29 Thread Frank Atanassow
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)

Re: functor

2001-10-29 Thread Wolfgang Jeltsch
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

functor

2001-10-29 Thread Chen Yu
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

Re: the constant functor

2001-03-27 Thread Tobias Haeberlein
> 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 -

the constant functor

2001-03-27 Thread Tobias Haeberlein
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

RE: Instance of Functor for functions of >= 2 arguments

2000-06-24 Thread Mark P Jones
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

Re: Instance of Functor for functions of >= 2 arguments

2000-06-24 Thread Keith Wansbrough
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

Instance of Functor for functions of >= 2 arguments

2000-06-23 Thread Matt Harden
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

RE: deriving Functor

2000-05-12 Thread Johan Jeuring
>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

RE: deriving Functor

2000-05-12 Thread Simon Peyton-Jones
| 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

Re: deriving Functor

2000-05-12 Thread Koen Claessen
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

deriving Functor

2000-05-11 Thread Tom Pledger
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

deriving Functor

2000-05-11 Thread Kuncak
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.

Re: rename class Functor ?

1998-11-16 Thread Hans Aberg
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

rename class Functor ?

1998-11-16 Thread S.D.Mechveliani
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