summaryrefslogtreecommitdiff
path: root/testsuite/tests/simplCore/should_compile/T22459.hs
blob: be28c5e2c000d1edea72012bff61fce4f7a44c98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{-# LANGUAGE UndecidableInstances #-}

{-# OPTIONS_GHC -O #-}

module Lib (foo) where

import qualified Data.Map as M

newtype Fix f = Fix (f (Fix f))

instance Eq (f (Fix f)) => Eq (Fix f) where
  Fix a == Fix b = a == b

instance Ord (f (Fix f)) => Ord (Fix f) where
  Fix a `compare` Fix b = a `compare` b

data Foo i r = Foo i r
  deriving (Eq, Ord)

newtype Bar a = Bar (M.Map Char (M.Map (Fix (Foo ())) Word))

foo :: Bar a -> Bar a -> Bar a
foo (Bar a) (Bar b) = Bar (M.unionWith M.union a b)