    {-# LANGUAGE Haskell2010 #-}
    module Classes where

    class Foo a where
        bar :: a -> Int
        baz :: Int -> (a, a)

    instance Foo Int where
        bar :: Int -> Int
    bar = forall a. a -> a
    id
        baz :: Int -> (Int, Int)
    baz Int
    x = (Int
    x, Int
    x)

    instance Foo [a] where
        bar :: [a] -> Int
    bar = forall (t :: * -> *) a. Foldable t => t a -> Int
    length
        baz :: Int -> ([a], [a])
    baz Int
    _ = ([], [])

    class Foo a => Foo' a where
        quux :: (a, a) -> a
        quux (a
    x, a
    y) = forall a. Foo' a => [a] -> a
    norf [a
    x, a
    y]

        norf :: [a] -> a
        norf = forall a. Foo' a => (a, a) -> a
    quux forall b c a. (b -> c) -> (a -> b) -> a -> c
    . forall a. Foo a => Int -> (a, a)
    baz forall b c a. (b -> c) -> (a -> b) -> a -> c
    . forall (t :: * -> *) a. (Foldable t, Num a) => t a -> a
    sum forall b c a. (b -> c) -> (a -> b) -> a -> c
    . forall a b. (a -> b) -> [a] -> [b]
    map forall a. Foo a => a -> Int
    bar

    instance Foo' Int where
        norf :: [Int] -> Int
    norf = forall (t :: * -> *) a. (Foldable t, Num a) => t a -> a
    sum

    instance Foo' [a] where
        quux :: ([a], [a]) -> [a]
    quux = forall a b c. (a -> b -> c) -> (a, b) -> c
    uncurry forall a. [a] -> [a] -> [a]
    (++)

    class Plugh p where
        plugh :: p a a -> p b b -> p (a -> b) (b -> a)

    instance Plugh Either where
        plugh :: forall a b. Either a a -> Either b b -> Either (a -> b) (b -> a)
    plugh (Left a
    a) Either b b
    _ = forall a b. b -> Either a b
    Right forall a b. (a -> b) -> a -> b
    $ forall a b. a -> b -> a
    const a
    a
        plugh (Right a
    a) Either b b
    _ = forall a b. b -> Either a b
    Right forall a b. (a -> b) -> a -> b
    $ forall a b. a -> b -> a
    const a
    a
        plugh Either a a
    _ (Left b
    b) = forall a b. a -> Either a b
    Left forall a b. (a -> b) -> a -> b
    $ forall a b. a -> b -> a
    const b
    b
        plugh Either a a
    _ (Right b
    b) = forall a b. a -> Either a b
    Left forall a b. (a -> b) -> a -> b
    $ forall a b. a -> b -> a
    const b
    b