Skip to content

Instantly share code, notes, and snippets.

@kcsongor
Created November 30, 2017 11:43
Show Gist options
  • Save kcsongor/83f0ee1316c2784428248199032cfe56 to your computer and use it in GitHub Desktop.
Save kcsongor/83f0ee1316c2784428248199032cfe56 to your computer and use it in GitHub Desktop.
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
module Overlapping where
class C a b where
f :: a -> b -> Bool
instance C a b where
f _ _ = False
instance {-# OVERLAPPING #-} C a a where
f _ _ = True
-- >>> f 'a' 'b'
-- True
--
-- >>> f 'a' "starfish"
-- False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment