named

Named parameters (keyword arguments) for Haskell

Latest on Hackage:0.3.0.1@rev:1

See all snapshots named appears in

BSD-3-Clause licensed by Vladislav Zavialov
Maintained by Vladislav Zavialov

Module documentation for 0.1.0.0

This version can be pinned in stack with:named-0.1.0.0@sha256:edf932d939edd93d3b8c9d319a43f9d550d3fa7e4fb9d93a8040e653b882eb1a,2043

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 :: FilePath `Named` "from" -> FilePath `Named` "to" -> IO ()
createSymLink (Named from) (Named to) = ...

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

Changes

0.1.0.0

  • First version. Released on an unsuspecting world.
Depends on 1 package(full list with versions):