packages feed

filepather-0.4.1: src/System/FilePath/FilePather/Compose.hs

{-# OPTIONS_GHC -Wall #-}
{-# LANGUAGE NoImplicitPrelude #-}

module System.FilePath.FilePather.Compose(
  composeToRead
, (->>-)
, composeReadTo
, (-<<-)
) where

import Control.Lens ( view, Wrapped(_Wrapped') )
import Data.Functor.Bind ( (-<-), (->-), Bind )
import System.FilePath.FilePather.ReadFilePath
    ( ReadFilePathT(..) )
import System.FilePath.FilePather.ToFilePath ( ToFilePathT(..) )

composeToRead ::
  Bind f =>
  ToFilePathT f a
  -> ReadFilePathT f b
  -> a
  -> f b
composeToRead f g =
  view _Wrapped' f ->- view _Wrapped' g

(->>-) ::
  Bind f =>
  ToFilePathT f a
  -> ReadFilePathT f b
  -> a
  -> f b
(->>-) =
  composeToRead

infixr 1 ->>-

composeReadTo ::
  Bind f =>
  ReadFilePathT f b
  -> ToFilePathT f a
  -> a
  -> f b
composeReadTo f g =
  view _Wrapped' f -<- view _Wrapped' g

(-<<-) ::
  Bind f =>
  ReadFilePathT f b
  -> ToFilePathT f a
  -> a
  -> f b
(-<<-) =
  composeReadTo

infixr 1 -<<-