Difference between revisions of "Implicit parameters"
Jump to navigation
Jump to search
m (Fix link to GHC doc) |
|||
Line 1: | Line 1: | ||
− | The GHC manual on implicit parameters: [ |
+ | The GHC manual on implicit parameters: [https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#implicit-parameters]. |
Working example: |
Working example: |
Revision as of 14:03, 9 July 2016
The GHC manual on implicit parameters: [1].
Working example:
{-# LANGUAGE ImplicitParams #-} import Data.List (sortBy) sort :: (?cmp :: a -> a -> Ordering) => [a] -> [a] sort = sortBy ?cmp main = let ?cmp = compare in putStrLn (show (sort [3,1,2]))