{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, FunctionalDependencies 
  #-}

import Prelude hiding (($))
import qualified Prelude as P

class Applicable f t | f -> t where
    apply :: f a -> t -> a

instance Applicable [] Int where
    apply = (!!)

instance Applicable ((->) a) a where
    apply = (P.$)

($) :: Applicable f t => f a -> t -> a
($) = apply
infixr 9 $

main = do putStrLn $ show $ [1,2,3] $ 1

