tvl-depot/users/Profpatsch/my-prelude/src/ValidationParseT.hs
Profpatsch 57bab040ed chore(users/Profpatsch): move utils to my-prelude
I want to use these in multiple projects.

Change-Id: I5dfdad8614bc5835e59df06f724de78acae78d42
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8971
Reviewed-by: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
2023-07-16 20:15:49 +00:00

16 lines
555 B
Haskell

module ValidationParseT where
import Control.Selective (Selective)
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, Selective)
via ( Compose
((->) env)
(Compose m (Validation (NonEmpty Error)))
)