Skip to content

monadfix/named

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

named – keyword arguments for Haskell

Build Status Hackage

named is a lightweight library for named function parameters (keyword arguments) based on overloaded labels. Keyword arguments have several advantages over positional arguments:

  • they can be supplied in arbitrary order
  • their names serve as documentation at call site
  • it is impossible to accidentally mix them up

Unlike newtype wrappers, keyword arguments don't pollute the global namespace, don't require top-level definitions, and don't need to be exported.

This implementation of named parameters is typesafe, provides good type inference, descriptive type errors, and has no runtime overhead.

Example usage:

import Named

createSymLink :: "from" :! FilePath -> "to" :! FilePath -> IO ()
createSymLink (Arg from) (Arg to) = ...

main = createSymLink ! #from "/path/to/source"
                     ! #to "/target/path"

About

Named parameters (keyword arguments) for Haskell

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published