{-|
Module      : Pipes.KeyValueCsv.Types.Common
Copyright   : (c) Marcin Mrotek, 2015
License     : BSD3
Maintainer  : marcin.jan.mrotek@gmail.com
Stability   : experimental

Types common to both CSV and key-value part of the library, and reexports of abstract types.
-}

{-# LANGUAGE
    DataKinds
  , GADTs
  , FlexibleContexts
  , ScopedTypeVariables
  , PolyKinds
  , RankNTypes
  , TypeOperators
  #-}

module Pipes.KeyValueCsv.Types.Common
  ( Line
  , Lines
  , Cell
  , Cells
  , Delimiter
  , module Pipes.KeyValueCsv.Types.Common
  ) where

import Pipes.KeyValueCsv.Internal.Types 

import Data.Vinyl.Functor
import Data.Text (Text)
import Pipes.Parse (Parser)

-- |As 'Parser' is a type synonym, it can't be partially applied as an argument for 'Rec'.
newtype WrapParser (a :: *) (m :: * -> *) (r :: *) = WrapParser { unwrapParser :: Parser a m r }

-- |Shorthand for a 'Parser' of 'Text' that can return a 'String' error a'la "Data.Text.Read".
type CellParser (m :: * -> *) (f :: k -> *) = WrapParser Text m :. (Either String :. f)