Ticket #3046: Funky.hs

File Funky.hs, 327 bytes (added by LouisWasserman, 7 years ago)

A test example.

Line 
1{-# LANGUAGE TypeFamilies, GeneralizedNewtypeDeriving #-}
2
3module Funky where
4
5class Foo a where
6        type Bar a
7        foobar :: a -> Bar a
8
9instance Foo Int where
10        type Bar Int = Int
11        foobar = id
12
13newtype Int2 = I2 Int deriving (Foo)
14
15-- I would expect ans to have type Int, but it does not resolve beyond Bar Int2.
16ans = foobar (I2 1)