about summary refs log tree commit diff
path: root/users/Profpatsch/whatcd-resolver/src/ValidationParseT.hs
blob: 62322a0ac0bc604c652131604fc0d2e8d222378d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
module ValidationParseT where

import Data.Functor.Compose (Compose (..))
import PossehlAnalyticsPrelude

-- | A simple way to create an Applicative parser that parses from some environment.
--
-- Use with DerivingVia. Grep codebase for examples.
newtype ValidationParseT env m a = ValidationParseT {unValidationParseT :: env -> m (Validation (NonEmpty Error) a)}
  deriving
    (Functor, Applicative)
    via ( Compose
            ((->) env)
            (Compose m (Validation (NonEmpty Error)))
        )