https://github.com/monadfix/named
Named parameters (keyword arguments) for Haskell
https://github.com/monadfix/named
haskell
Last synced: 3 months ago
JSON representation
Named parameters (keyword arguments) for Haskell
- Host: GitHub
- URL: https://github.com/monadfix/named
- Owner: monadfix
- License: other
- Created: 2018-02-01T12:13:49.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2025-03-16T09:19:53.000Z (4 months ago)
- Last Synced: 2025-03-28T05:12:02.183Z (4 months ago)
- Topics: haskell
- Language: Haskell
- Size: 44.9 KB
- Stars: 94
- Watchers: 6
- Forks: 5
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog.md
- License: LICENSE
Awesome Lists containing this project
README
# `named` – keyword arguments for Haskell
[](https://hackage.haskell.org/package/named)
`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 upUnlike 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:
```haskell
import NamedcreateSymLink :: "from" :! FilePath -> "to" :! FilePath -> IO ()
createSymLink (Arg from) (Arg to) = ...main = createSymLink ! #from "/path/to/source"
! #to "/target/path"
```