{-# LANGUAGE NoImplicitPrelude #-} module DSV.TextReaderView ( textReaderView , textReaderView_ ) where import DSV.Prelude import DSV.Text import DSV.Validation import DSV.ViewType textReaderView :: e -> TextReader a -> View e Text a textReaderView :: e -> TextReader a -> View e Text a textReaderView e e TextReader a r = (Text -> Validation e a) -> View e Text a forall e a b. (a -> Validation e b) -> View e a b View ((Text -> Validation e a) -> View e Text a) -> (Text -> Validation e a) -> View e Text a forall a b. (a -> b) -> a -> b $ \Text txt -> case (TextReader a -> Text -> Maybe a forall a. TextReader a -> Text -> Maybe a textReadMaybe TextReader a r Text txt) of Maybe a Nothing -> e -> Validation e a forall err a. err -> Validation err a Failure e e Just a x -> a -> Validation e a forall err a. a -> Validation err a Success a x textReaderView_ :: TextReader a -> View () Text a textReaderView_ :: TextReader a -> View () Text a textReaderView_ TextReader a r = (Text -> Validation () a) -> View () Text a forall e a b. (a -> Validation e b) -> View e a b View ((Text -> Validation () a) -> View () Text a) -> (Text -> Validation () a) -> View () Text a forall a b. (a -> b) -> a -> b $ \Text txt -> case (TextReader a -> Text -> Maybe a forall a. TextReader a -> Text -> Maybe a textReadMaybe TextReader a r Text txt) of Maybe a Nothing -> () -> Validation () a forall err a. err -> Validation err a Failure () Just a x -> a -> Validation () a forall err a. a -> Validation err a Success a x