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.
Related Contents:
- Good examples of Not a Functor/Functor/Applicative/Monad?
- foldl versus foldr behavior with infinite lists
- Can someone explain the traverse function in Haskell?
- How does foldr work?
- Monads as adjunctions
- Why should I use applicative functors in functional programming?
- Writing foldl using foldr
- Haskell – foldl and foldr?
- What constitutes a fold for types other than list?
- Fun with repeated fmap
- How do functors work in haskell?
- Differences between functors and endofunctors
- What is a contravariant functor?
- Understanding how Either is an instance of Functor
- Why does the 2-tuple Functor instance only apply the function to the second element?
- Getting started with Haskell
- Good Haskell source to read and learn from [closed]
- Why are side-effects modeled as monads in Haskell?
- Specialization with Constraints
- How to ship an executable with Language.Haskell.Interpreter?
- What is the Comonad typeclass in Haskell?
- How do I clear the terminal screen in Haskell?
- How to provide explicit type declarations for functions when using GHCi?
- Recursion schemes for dummies?
- How to run a Haskell file in interpreted mode
- DatatypeContexts Deprecated in Latest GHC: Why?
- What is supercompilation?
- What does Haskell’s operator do?
- What are skolems?
- Left and Right Folding over an Infinite list
- Monads with Join() instead of Bind()
- Why is the bind operator (>>=) defined as it is?
- My cabal packages are FUBAR; how can I purge them and start over?
- When is it OK to use an IORef?
- What does “pure” mean in “pure functional language”?
- Sets, Functors and Eq confusion
- Integral operators quot vs. div
- Mixing Erlang and Haskell
- Binding FFI and DSL
- Y Combinator in Haskell
- Good introduction to free theorems [closed]
- How can I use HaskellDB with polymorphic fields? (Problems with overlapping instances)
- “Illegal type synonym family application in instance” with functional dependency
- What’s the difference between parametric polymorphism and higher-kinded types?
- Good resources on using functional programming in game development? [closed]
- How does the flip function work?
- Can I get `cabal install` to use multiple cores?
- How can I bind the second argument in a function but not the first (in an elegant way)?
- Efficient heaps in purely functional languages
- Parallel map in haskell