Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Fake a monad transformer #32

Merged
merged 5 commits into from
Jun 10, 2021

Commits on Jun 10, 2021

  1. Configuration menu
    Copy the full SHA
    ada99a7 View commit details
    Browse the repository at this point in the history
  2. Add FakeT monad transformer

    This is a use-case that came up in my work, where we were generating
    lots of 'Fake' values. The trouble with running 'Fake' is that parsing
    YAML and building the cache are very expensive, but all the effort
    involved is thrown away after the 'Fake' is run - so it makes sense to
    generate as much data as possible all in the same 'Fake'. But if you're
    using a monad stack, you would have to put 'Fake' at the bottom - when
    instead it makes more sense as a transformer, which can share a single
    YAML parser and cache between many 'Fake' runs.
    
    This adds the 'FakeT' monad transformer, and makes 'Fake' a synonym for
    @FAKET IO@, preserving as much backwards-compatibility as possible with
    functions and pattern synonyms.
    ivanbakel committed Jun 10, 2021
    Configuration menu
    Copy the full SHA
    46c4201 View commit details
    Browse the repository at this point in the history
  3. Add MonadFake class for lifting Fakes

    Following on from the 'FakeT' transformer, it makes sense to be able to
    "lift" the default 'Fake' values into the monad stack, in order to allow
    them to actually share the transformer cache and generator. This is done
    by the 'MonadFake' class, which comes with an instance for 'FakeT', as
    well as some of the other transformers defined in the `transformers`
    package.
    ivanbakel committed Jun 10, 2021
    Configuration menu
    Copy the full SHA
    7adab57 View commit details
    Browse the repository at this point in the history
  4. Generalise combinators to FakeT

    This allows users to use combinators on any 'FakeT', instead of just the
    base 'Fake' monad.
    ivanbakel committed Jun 10, 2021
    Configuration menu
    Copy the full SHA
    494201d View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    9750120 View commit details
    Browse the repository at this point in the history