T10403.hs 462 Bytes
Newer Older
Simon Peyton Jones's avatar
Simon Peyton Jones committed
1
{-# LANGUAGE PartialTypeSignatures #-}
2
{-# OPTIONS_GHC -fdefer-type-errors #-}
Simon Peyton Jones's avatar
Simon Peyton Jones committed
3
4
5
6
7
8
9
10
11
12
13
14
15
module T10403 where

data I a = I a
instance Functor I where
    fmap f (I a) = I (f a)

newtype B t a = B a
instance Functor (B t) where
    fmap f (B a) = B (f a)

newtype H f = H (f ())

h :: _ => _
16
-- h :: Functor m => (a -> b) -> m a -> H m
Simon Peyton Jones's avatar
Simon Peyton Jones committed
17
h f b = (H . fmap (const ())) (fmap f b)
18
19
20
21

h2 :: _
-- h2 :: Functor m => (a -> b) -> m a -> H m
h2 f b = (H . fmap (const ())) (fmap f b)