Commit 801cbb42 authored by Simon Peyton Jones's avatar Simon Peyton Jones Committed by Ben Gamari

More tests for Trac #12522

These ones test the variations in coment:15 of the ticket

(cherry picked from commit a6111b8c)
parent 12cfcbeb
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE TypeFamilyDependencies #-}
{-# LANGUAGE TypeOperators #-}
module T12522a where
newtype I a = I a
type family Curry (as :: [*]) b = f | f -> as b where
Curry '[] b = I b
Curry (a:as) b = a -> Curry as b
data Uncurried (as :: [*]) b
def :: Curry as b -> Uncurried as b
def = undefined
-- test2 :: Uncurried [Bool, Bool] Bool
test2 = def $ \a b -> I $ a && b
......@@ -275,3 +275,4 @@ test('T11361', normal, compile, [''])
test('T11361a', normal, compile_fail, [''])
test('T12175', normal, compile, [''])
test('T12522', normal, compile, [''])
test('T12522b', normal, compile, [''])
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE TypeFamilyDependencies #-}
{-# LANGUAGE TypeOperators #-}
module T12522a where
newtype I a = I a
type family Curry (as :: [*]) b = f | f -> as b where
Curry '[] b = I b
Curry (a:as) b = a -> Curry as b
data Uncurried (as :: [*]) b
def :: Curry as b -> Uncurried as b
def = undefined
-- test :: Uncurried [Int, String] String
test = def $ \n s -> I $ show n ++ s
T12522a.hs:20:26: error:
• Ambiguous type variable ‘a0’ arising from a use of ‘show’
prevents the constraint ‘(Show a0)’ from being solved.
Relevant bindings include
n :: a0 (bound at T12522a.hs:20:15)
test :: Uncurried '[a0, [Char]] [Char] (bound at T12522a.hs:20:1)
Probable fix: use a type annotation to specify what ‘a0’ should be.
These potential instances exist:
instance Show Ordering -- Defined in ‘GHC.Show’
instance Show Integer -- Defined in ‘GHC.Show’
instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’
...plus 22 others
...plus five instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the first argument of ‘(++)’, namely ‘show n’
In the second argument of ‘($)’, namely ‘show n ++ s’
In the expression: I $ show n ++ s
......@@ -140,3 +140,4 @@ test('T10899', normal, compile_fail, [''])
test('T11136', normal, compile_fail, [''])
test('T7788', normal, compile_fail, [''])
test('T12041', normal, compile_fail, [''])
test('T12522a', normal, compile_fail, [''])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment