<commit_before>homepage: https://github.com/michalkonecny/collect-errors#readme
changelog-type: markdown
hash: f4e53bb3f8b2a3395922c6e04dff65db76ef38aca9264a987785c90f01b5c09c
test-bench-deps: {}
maintainer: <EMAIL>
synopsis: Error monad with a Float instance
changelog: |
  # Changelog for collect-errors

  ## v0.1.1.0

  * Add removeValue functions

  ## v0.1.0.0

  * Initial port of CollectErrors and CN from mixed-types-num-0.4.1

  * Simplify the code by abandoning EnsureCE and related type functions and utilities

  * NumErrors within CN are now a set to prevent multiple occurrences of the same error

  * Add CollectError or CN instances for various Prelude type classes, including Num and Floating, checking for domain violations
basic-deps:
  base: '>=4.7 && <5'
  containers: -any
  QuickCheck: '>=2.7'
all-versions:
- 0.1.0.0
- 0.1.1.0
author: <NAME>
latest: 0.1.1.0
description-type: markdown
description: |
  # collect-errors

  `CollectErrors es t` is a monad wrapper around values of type `t` which can accommodate (a list of)
  (potential) errors of type `es` that have (maybe) occurred during the computation
  of a value.  A value may be missing, leaving only the error(s).

  The wrapper `CN t` is a special case of `CollectErrors es t` with `es` = `NumErrors`.

  The `CN` wrapper also propagates instances of `Floating`,
  allowing us to write expressions with partial
  functions (ie functions that fail for some inputs) instead of
  branching after each application of such function:

      *Numeric.CollectErrors> a = 1 :: CN Double
      *Numeric.CollectErrors> (1/(a-1))+(sqrt (a-2))
      {{ERROR: division by 0; ERROR: out of domain: sqrt for negative arg -1.0}}

  as opposed to:

      *Prelude> a = 1 :: Double
      *Prelude> (1/(a-1))+(sqrt (a-2))
      NaN

  Dealing with the errors can be moved outside the expression:

      *Numeric.CollectErrors> a = 1 :: CN Double
      *Numeric.CollectErrors> toEither $ 1/(a-1)
      Left {ERROR: division by 0}<commit_msg>Update from Hackage at 2021-05-12T01:58:09Z<commit_after>homepage: https://github.com/michalkonecny/collect-errors#readme
changelog-type: markdown
hash: 63aac5b27853cf3308586bc097fec3518e20b880b956b4a5520b337e8fb8aeb0
test-bench-deps: {}
maintainer: <EMAIL>
synopsis: Error monad with a Float instance
changelog: |
  # Changelog for collect-errors

  ## v0.1.2.0

  * Add CanTakeErrors type class and liftTakeErrors function

  * Add instance of deepseq's NFData

  ## v0.1.1.0

  * Add removeValue functions

  ## v0.1.0.0

  * Initial port of CollectErrors and CN from mixed-types-num-0.4.1

  * Simplify the code by abandoning EnsureCE and related type functions and utilities

  * NumErrors within CN are now a set to prevent multiple occurrences of the same error

  * Add CollectError or CN instances for various Prelude type classes, including Num and Floating, checking for domain violations
basic-deps:
  base: '>=4.7 && <5'
  containers: -any
  deepseq: -any
  QuickCheck: '>=2.7'
all-versions:
- 0.1.0.0
- 0.1.1.0
- 0.1.2.0
author: <NAME>
latest: 0.1.2.0
description-type: markdown
description: |
  # collect-errors

  `CollectErrors es t` is a monad wrapper around values of type `t` which can accommodate (a list of)
  (potential) errors of type `es` that have (maybe) occurred during the computation
  of a value.  A value may be missing, leaving only the error(s).

  The wrapper `CN t` is a special case of `CollectErrors es t` with `es` = `NumErrors`.

  The `CN` wrapper also propagates instances of `Floating`,
  allowing us to write expressions with partial
  functions (ie functions that fail for some inputs) instead of
  branching after each application of such function:

      *Numeric.CollectErrors> a = 1 :: CN Double
      *Numeric.CollectErrors> (1/(a-1))+(sqrt (a-2))
      {{ERROR: division by 0; ERROR: out of domain: sqrt for negative arg -1.0}}

  as opposed to:

      *Prelude> a = 1 :: Double
      *Prelude> (1/(a-1))+(sqrt (a-2))
      NaN

  Dealing with the errors can be moved outside the expression:

      *Numeric.CollectErrors> a = 1 :: CN Double
      *Numeric.CollectErrors> toEither $ 1/(a-1)
      Left {ERROR: division by 0}
{'fraction_non_alphanumeric': 0.09810959559703278, 'fraction_numerical': 0.0449868389566882, 'mean_word_length': 3.5833333333333335, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 23, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 12, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '795256', 'n_tokens_mistral': 1482, 'n_tokens_neox': 1353, 'n_words': 501}