Created
November 18, 2020 17:17
-
-
Save googleson78/842ae86a0d5d14674d2c21be6ce8fea5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE AllowAmbiguousTypes #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE PolyKinds #-} | |
{-# LANGUAGE TypeFamilies #-} | |
type family Ambiguous (a :: k) :: b where | |
Ambiguous x = x | |
all' :: Foldable (Ambiguous t) => (a -> Bool) -> Ambiguous t a -> Bool | |
all' = all | |
x :: Bool | |
x = all' (const True) [] | |
-- ambig.hs:13:23: error: | |
-- • Couldn't match type ‘Ambiguous t0’ with ‘[]’ | |
-- Expected type: Ambiguous t0 b0 | |
-- Actual type: [b0] | |
-- The type variable ‘t0’ is ambiguous | |
-- • In the second argument of ‘all'’, namely ‘[]’ | |
-- In the expression: all' (const True) [] | |
-- In an equation for ‘x’: x = all' (const True) [] | |
-- | | |
-- 13 | x = all' (const True) [] | |
-- | ^^ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment