module Data.Sv.Parse (
ParseOptions (..)
, defaultParseOptions
, defaultSeparator
, defaultHeadedness
) where
import Data.Sv.Structure.Separator (Separator, HasSeparator (separator), comma)
import Data.Sv.Structure.Headedness (Headedness (Headed), HasHeadedness (headedness))
data ParseOptions =
ParseOptions {
_separator :: Separator
, _headedness :: Headedness
}
instance HasHeadedness ParseOptions where
headedness f (ParseOptions s h) = ParseOptions s <$> f h
instance HasSeparator ParseOptions where
separator f (ParseOptions s h) = (\y -> ParseOptions y h) <$> f s
defaultParseOptions :: ParseOptions
defaultParseOptions = ParseOptions defaultSeparator defaultHeadedness
defaultSeparator :: Separator
defaultSeparator = comma
defaultHeadedness :: Headedness
defaultHeadedness = Headed