codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
{-# 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
Private
[
?
]
Run code