summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_compile/T9892.hs
blob: adb0f29818ae7da58da0b76038e4548be27f60b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{-# LANGUAGE UndecidableInstances #-}

module T9892 where

import Control.Applicative
import Control.Category
import Prelude hiding ((.),id)

newtype FocusingPlus w k s a = FocusingPlus { unfocusingPlus :: k (s, w) a }

instance Functor (k (s, w)) => Functor (FocusingPlus w k s) where
  fmap f (FocusingPlus as) = FocusingPlus (fmap f as)

instance Applicative (k (s, w)) => Applicative (FocusingPlus w k s) where
  pure = FocusingPlus . pure
  FocusingPlus kf <*> FocusingPlus ka = FocusingPlus (kf <*> ka)