blob: 7464a078aa5b1f724e09a72ac960e70c70f1d6b4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
{-# LANGUAGE TypeFamilies #-}
module ShouldCompile where
class Cls a where
type Fam a :: *
type Fam a = Maybe a
instance Cls Int where
-- Gets type family from default
inc :: (Fam a ~ Maybe Int) => a -> Fam a -> Fam a
inc _proxy (Just x) = Just (x + 1)
inc _proxy Nothing = Just 0
foo :: Maybe Int -> Maybe Int
foo = inc (undefined :: Int)
|