Here’s a fully parametric example:
data Weird a = Weird a (a -> a)
instance Foldable Weird where
foldMap f (Weird a b) = f $ b a
Weird
is not a Functor
because a
occurs in a negative position.
More Related Contents:
- Good examples of Not a Functor/Functor/Applicative/Monad?
- foldl versus foldr behavior with infinite lists
- Writing foldl using foldr
- How do functors work in haskell?
- What constitutes a fold for types other than list?
- Foldr/Foldl for free when Tree is implementing Foldable foldMap?
- How does foldr work?
- Implement zip using foldr
- How to return a pure value from a impure method
- Why give me error? [closed]
- Haskell ranges and floats
- Defining a function by equations with different number of arguments
- :sprint for polymorphic values?
- Small Haskell program compiled with GHC into huge binary
- DatatypeContexts Deprecated in Latest GHC: Why?
- What does the exclamation mark mean in a Haskell declaration?
- Haskell function composition operator of type (c→d) → (a→b→c) → (a→b→d)
- Unwrapping a monad
- What are “n+k patterns” and why are they banned from Haskell 2010?
- Haskell read raw keyboard input
- Currying 3 Arguments in Haskell
- Defining a new monad in haskell raises no instance for Applicative
- What are Alternative’s “some” and “many” useful for?
- Check whether a type is an instance of Show in Haskell at runtime?
- Why is Haskell (sometimes) referred to as “Best Imperative Language”?
- Why should Applicative be a superclass of Monad?
- withFile vs. openFile
- Haskell Constraint is no smaller than the instance head
- Is there, in Haskell, something similar to sub-guards?
- What is the Comonad typeclass in Haskell?