homepage: https://github.com/chrisdone/caseof#readme
changelog-type: ''
hash: 9475c25117f7394773880cc5e46c82e44aaeba0d1ea77c3f3826df9adb129dbb
test-bench-deps: {}
maintainer: chrisdone@gmail.com
synopsis: Combinators for casing on constructors
changelog: ''
basic-deps:
  base: ! '>=4.7 && <5'
  template-haskell: -any
all-versions:
- '0.0.0'
author: Chris Done
latest: '0.0.0'
description-type: markdown
description: ! "# caseof\n\nA simple way to query constructors, like cases but slightly
  more\nconcise.\n\nAimed at sum types with many constructors:\n\n``` haskell\ndata
  Wiggle = Woo Int Char | Wibble Int deriving Show\n```\n\nThere is a case predicate:\n\n```
  haskell\n> $(isCaseOf 'Woo) (Woo 5 'a')\nTrue\n```\n\nThere is a `Maybe`-based matcher:\n\n```
  haskell\n> $(maybeCaseOf 'Woo) (Woo 1 'a')\nJust (1,'a')\n```\n\nThere is a combinator
  which calls your function with n arguments, or\npasses the whole value to an \"else\"
  clause.\n\n``` haskell\n> $(caseOf 'Woo) (\\x y -> show x ++ show y) (const \"\")
  (Wibble 5)\n\"\"\n```\n\nThis allows them to be nested:\n\n```haskell\n> $(caseOf
  'Woo) (\\x y -> show x ++ show y) (const \"\") (Woo 5 'a')\n\"5'a'\"\n> $(caseOf
  'Woo) (\\x y -> show x ++ show y) ($(caseOf 'Wibble) show (const \"\")) (Woo 5 'a')\n\"5'a'\"\n```\n\nWhat's
  the point of `caseOf`? To more easily dispatch on functions:\n\n```haskell\nhandleHuman
  name age = ...\nhandleMachine id = ..\nhandleWithDefault def =\n   $(caseOf 'Human)
  handleHuman .\n   $(caseOf 'Machine) handleMachine def\n```\n\nThis applies to any
  kind of \"case\" that you'd like to refactor into a function.\n\n## Use in your
  project\n\nIn your stack.yaml, put:\n\n```\nextra-deps:\n- git: https://github.com/chrisdone/caseof.git\n
  \ commit: 9a7f6bb\n```\n"
license-name: BSD3

Update from Hackage at 2018-03-07T13:12:16Z
Update from Hackage at 2018-03-07T13:12:16Z
