Suppose you have a class:
class AClass a where
func:: Int
instance AClass SomeTree where
func = 0
instance AClass Double where
func = 1
How do I call the function func?
Answer
{-# LANGUAGE AllowAmbiguousTypes, TypeApplications #-}
class AClass a where
func: : Int
instance AClass SomeTree where
func = 0
instance AClass Double where
func = 1
foo :: Int
foo = func @SomeTree + func @Double
{-# LANGUAGE ScopedTypeVariables, UnicodeSyntax #-}
bar :: ? a . AClass a => a -> Int
bar _ = func @a