[Haskell-cafe] Pointed, but not Applicative

roconnor at theorem.ca roconnor at theorem.ca
Wed Aug 31 16:48:02 CEST 2011


On Wed, 31 Aug 2011, roconnor at theorem.ca wrote:

> On Sat, 27 Aug 2011, Sönke Hahn wrote:
>
>> Hi!
>> 
>> I was reading through the Typeclassopedia ([1]) and I was wondering which 
>> type could be an instance of Pointed, but not of Applicative. But I can't 
>> think of one. Any ideas?
>
> (Identity :+: Store s) is a comonad that is also instance of Pointed, but I 
> do not believe it is an instance Applicative.
>
> newtype SemiStore s a = (Identity :+: Store s) a
>
> instance Pointed (SemiStore s) where
>  pure a = Inl (Identity a)
>
> Coalgebras of the (Identity :+: Store s) comonad form the type of partial 
> lenses so this isn't just an academic functor.

Sorry I left out the newtype wrappers:

newtype SemiStore s a = SemiStore ((Identity :+: Store s) a)

instance Pointed (SemiStore s) where
   pure = SemiStore . Inl . Identity

-- 
Russell O'Connor                                      <http://r6.ca/>
``All talk about `theft,''' the general counsel of the American Graphophone
Company wrote, ``is the merest claptrap, for there exists no property in
ideas musical, literary or artistic, except as defined by statute.''


More information about the Haskell-Cafe mailing list