[Haskell-cafe] Transparent identity instances

2010-11-28 Thread Jafet
Hi, Does it make sense to declare a transparent identity instance for Functor, Applicative, Monad, etc? For example, I might want to generalize ($) = (*) where ($) :: (a - b) - a - b (*) :: (Functor f) = f (a - b) - f a - f b The traditional definition makes Identity a newtype: newtype

Re: [Haskell-cafe] Transparent identity instances

2010-11-28 Thread Erik Hesselink
On Sun, Nov 28, 2010 at 15:59, Jafet jafet.vi...@gmail.com wrote: But using this instance becomes unwieldy. If using Identity was transparent, eg. if it was a type synonym {-# LANGUAGE TypeSynonymInstances #-} type Identity a = a instance Applicative Identity where   -- something like  

Re: [Haskell-cafe] Transparent identity instances

2010-11-28 Thread wren ng thornton
On 11/28/10 9:59 AM, Jafet wrote: But GHC does not accept type synonym instances unless they are fully applied. That's precisely the problem, and why a newtype is used. More than GHC implementation details, there's the deeper problem that allowing general type-level functions causes