Safe Haskell | None |
---|---|
Language | Haskell2010 |
User-friendly, type safe, runtime efficient tooling for working with tabular data deserialized from comma-separated values (CSV) files. The type of each row of data is inferred from data, which can then be streamed from disk, or worked with in memory.
Synopsis
- class Readable a where
- rcast :: forall k1 k2 (rs :: [k1]) (ss :: [k1]) (f :: k2 -> Type) record (is :: [Nat]). (RecSubset record rs ss is, RecSubsetFCtx record f) => record f ss -> record f rs
- rsubset :: forall k1 k2 (rs :: [k2]) (ss :: [k2]) (f :: k1 -> Type) g record (is :: [Nat]). (RecSubset record rs ss is, Functor g, RecSubsetFCtx record f) => (record f rs -> g (record f rs)) -> record f ss -> g (record f ss)
- (<+>) :: forall k (f :: k -> Type) (as :: [k]) (bs :: [k]). Rec f as -> Rec f bs -> Rec f (as ++ bs)
- data Rec (a :: u -> Type) (b :: [u])
- data ElField (field :: (Symbol, Type))
- onField :: forall c (ts :: [Type]) b. RPureConstrained c ts => (forall a. (a ∈ ts, c a) => a -> b) -> Field ts -> b
- onCoRec :: forall k1 k2 c f (ts :: [k1]) (b :: k2) g. RPureConstrained c ts => (forall (a :: k1). (a ∈ ts, c a) => f a -> g b) -> CoRec f ts -> g b
- type Field = CoRec Identity
- rfield :: forall f a b (s :: Symbol). Functor f => (a -> f b) -> ElField '(s, a) -> f (ElField '(s, b))
- type (:.) (f :: l -> Type) (g :: k -> l) = Compose f g
- module Data.Vinyl.Lens
- type family RDelete (r :: a) (rs :: [a]) :: [a] where ...
- type family RecAll (f :: u -> Type) (rs :: [u]) (c :: Type -> Constraint) where ...
- type family AllConstrained (c :: u -> Constraint) (ts :: [u]) where ...
- class AllSatisfied (cs :: k) (t :: k1)
- type family AllAllSat (cs :: k) (ts :: [k1]) where ...
- type (:->) (a :: Symbol) b = '(a, b)
- pattern Col :: KnownSymbol s => t -> ElField '(s, t)
- module Frames.ColumnUniverse
- readTableMaybe :: (MonadSafe m, ReadRec rs, RMap rs) => FilePath -> Producer (Rec (Maybe :. ElField) rs) m ()
- pipeTableMaybe :: (Monad m, ReadRec rs, RMap rs) => Pipe [Text] (Rec (Maybe :. ElField) rs) m ()
- readTableOpt :: (MonadSafe m, ReadRec rs, RMap rs) => ParserOptions -> FilePath -> Producer (Record rs) m ()
- readTable :: (MonadSafe m, ReadRec rs, RMap rs) => FilePath -> Producer (Record rs) m ()
- readTableDebug :: forall m rs. (MonadSafe m, ReadRec rs, RMap rs, RecMapMethod ShowCSV (Either Text :. ElField) rs, RecordToList rs) => FilePath -> Producer (Record rs) m ()
- pipeTable :: (ReadRec rs, RMap rs, Monad m) => Pipe [Text] (Record rs) m ()
- module Frames.Exploration
- module Frames.Frame
- inCoreAoS :: (PrimMonad m, MonadIO m, MonadMask m, RecVec rs) => Producer (Record rs) (SafeT m) () -> m (FrameRec rs)
- inCoreAoS' :: (PrimMonad m, MonadIO m, MonadMask m, RecVec rs) => (Rec ((->) Int :. ElField) rs -> Rec ((->) Int :. ElField) ss) -> Producer (Record rs) (SafeT m) () -> m (FrameRec ss)
- inCore :: (PrimMonad m, MonadIO m, MonadMask m, RecVec rs, Monad n) => Producer (Record rs) (SafeT m) () -> m (Producer (Record rs) n ())
- inCoreSoA :: (PrimMonad m, MonadIO m, MonadMask m, RecVec rs) => Producer (Record rs) (SafeT m) () -> m (Int, Rec ((->) Int :. ElField) rs)
- toAoS :: Int -> Rec ((->) Int :. ElField) rs -> FrameRec rs
- toFrame :: (Foldable f, RecVec rs) => f (Record rs) -> Frame (Record rs)
- filterFrame :: RecVec rs => (Record rs -> Bool) -> FrameRec rs -> FrameRec rs
- module Frames.Joins
- meltRow :: (vs ⊆ ts, ss ⊆ ts, vs ~ RDeleteAll ss ts, Disjoint ss ts ~ 'True, ts ≅ (vs ++ ss), ColumnHeaders vs, RowToColumn vs vs) => proxy ss -> Record ts -> [Record (ss ++ '["value" :-> CoRec ElField vs])]
- melt :: forall vs ts ss proxy. (vs ⊆ ts, ss ⊆ ts, vs ~ RDeleteAll ss ts, HasLength vs, Disjoint ss ts ~ 'True, ts ≅ (vs ++ ss), ColumnHeaders vs, RowToColumn vs vs) => proxy ss -> FrameRec ts -> FrameRec (ss ++ '["value" :-> CoRec ElField vs])
- type family RecordColumns t where ...
- type Record = FieldRec
- (&:) :: KnownSymbol s => a -> Record rs -> Record ((s :-> a) ': rs)
- recUncons :: Record ((s :-> a) ': rs) -> (a, Record rs)
- recMaybe :: Rec (Maybe :. ElField) cs -> Maybe (Record cs)
- showFields :: (RecMapMethod Show ElField ts, RecordToList ts) => Record ts -> [String]
- rgetField :: forall t s a rs. (t ~ '(s, a), t ∈ rs) => Record rs -> a
- rputField :: forall t s a rs. (t ~ '(s, a), t ∈ rs, KnownSymbol s) => a -> Record rs -> Record rs
- module Frames.RecF
- declareColumn :: Text -> Name -> DecsQ
- tableTypes :: String -> FilePath -> DecsQ
- tableTypes' :: forall a c. (c ~ CoRec ColInfo a, ColumnTypeable c, Monoid c) => RowGen a -> DecsQ
- module Frames.TypeLevel
- runSafeP :: forall (m :: Type -> Type) r. (MonadMask m, MonadIO m) => Effect (SafeT m) r -> Effect' m r
- runSafeT :: (MonadMask m, MonadIO m) => SafeT m r -> m r
- data SafeT (m :: Type -> Type) r
- class (MonadCatch m, MonadMask m, MonadIO m, MonadIO (Base m)) => MonadSafe (m :: Type -> Type)
- runSafeEffect :: (MonadIO m, MonadMask m) => Effect (SafeT m) r -> m r
- data Text
Documentation
ByteString and Text reading using MonadPlus to handle parse failure. On error, fromText and fromBS will return mzero. You can use mplus to provide fallback defaults.
fromText :: MonadPlus m => Text -> m a #
Reads data from a Text representation.
fromBS :: MonadPlus m => ByteString -> m a #
Reads data from a UTF8 encoded ByteString. The default implementation of this function simply decodes with UTF-8 and then calls the fromText function. If decoding fails, mzero will be returned. You can provide your own implementation if you need different behavior such as not decoding to UTF8.
Instances
Readable Bool | |
Readable Double | |
Readable Float | |
Readable Int | |
Readable Int8 | |
Readable Int16 | |
Readable Int32 | |
Readable Int64 | |
Readable Integer | |
Readable Word8 | |
Readable Word16 | |
Readable Word32 | |
Readable Word64 | |
Readable ByteString | |
Defined in Data.Readable fromText :: MonadPlus m => Text -> m ByteString # fromBS :: MonadPlus m => ByteString -> m ByteString # | |
Readable Text | |
rcast :: forall k1 k2 (rs :: [k1]) (ss :: [k1]) (f :: k2 -> Type) record (is :: [Nat]). (RecSubset record rs ss is, RecSubsetFCtx record f) => record f ss -> record f rs #
Takes a larger record to a smaller one by forgetting fields. This
is rcastC
with the type arguments reordered for more convenient
usage with TypeApplications
.
rsubset :: forall k1 k2 (rs :: [k2]) (ss :: [k2]) (f :: k1 -> Type) g record (is :: [Nat]). (RecSubset record rs ss is, Functor g, RecSubsetFCtx record f) => (record f rs -> g (record f rs)) -> record f ss -> g (record f ss) #
A lens into a slice of the larger record. This is rsubsetC
with
the type arguments reordered for more convenient usage with
TypeApplications
.
(<+>) :: forall k (f :: k -> Type) (as :: [k]) (bs :: [k]). Rec f as -> Rec f bs -> Rec f (as ++ bs) infixr 5 #
A shorthand for rappend
.
data Rec (a :: u -> Type) (b :: [u]) #
A record is parameterized by a universe u
, an interpretation f
and a
list of rows rs
. The labels or indices of the record are given by
inhabitants of the kind u
; the type of values at any label r :: u
is
given by its interpretation f r :: *
.
Instances
RecSubset (Rec :: (k -> Type) -> [k] -> Type) ('[] :: [k]) (ss :: [k]) ('[] :: [Nat]) | |
Defined in Data.Vinyl.Lens type RecSubsetFCtx Rec f # rsubsetC :: forall g (f :: k0 -> Type). (Functor g, RecSubsetFCtx Rec f) => (Rec f '[] -> g (Rec f '[])) -> Rec f ss -> g (Rec f ss) # rcastC :: forall (f :: k0 -> Type). RecSubsetFCtx Rec f => Rec f ss -> Rec f '[] # rreplaceC :: forall (f :: k0 -> Type). RecSubsetFCtx Rec f => Rec f '[] -> Rec f ss -> Rec f ss # | |
(RElem r ss i, RSubset rs ss is) => RecSubset (Rec :: (k -> Type) -> [k] -> Type) (r ': rs :: [k]) (ss :: [k]) (i ': is) | |
Defined in Data.Vinyl.Lens type RecSubsetFCtx Rec f # rsubsetC :: forall g (f :: k0 -> Type). (Functor g, RecSubsetFCtx Rec f) => (Rec f (r ': rs) -> g (Rec f (r ': rs))) -> Rec f ss -> g (Rec f ss) # rcastC :: forall (f :: k0 -> Type). RecSubsetFCtx Rec f => Rec f ss -> Rec f (r ': rs) # rreplaceC :: forall (f :: k0 -> Type). RecSubsetFCtx Rec f => Rec f (r ': rs) -> Rec f ss -> Rec f ss # | |
RecElem (Rec :: (a -> Type) -> [a] -> Type) (r :: a) (r' :: a) (r ': rs :: [a]) (r' ': rs :: [a]) 'Z | |
Defined in Data.Vinyl.Lens type RecElemFCtx Rec f # | |
(RIndex r (s ': rs) ~ 'S i, RecElem (Rec :: (a -> Type) -> [a] -> Type) r r' rs rs' i) => RecElem (Rec :: (a -> Type) -> [a] -> Type) (r :: a) (r' :: a) (s ': rs :: [a]) (s ': rs' :: [a]) ('S i) | |
Defined in Data.Vinyl.Lens type RecElemFCtx Rec f # | |
(AllCols Grouping rs, Grouping (Record rs), Grouping (ElField (s :-> r)), Grouping r) => Grouping (Record ((s :-> r) ': rs)) Source # | |
Grouping (Record ('[] :: [(Symbol, Type)])) Source # | |
Defined in Frames.ExtraInstances | |
TestCoercion f => TestCoercion (Rec f :: [u] -> Type) | |
Defined in Data.Vinyl.Core | |
TestEquality f => TestEquality (Rec f :: [u] -> Type) | |
Defined in Data.Vinyl.Core | |
Eq (Rec f ('[] :: [u])) | |
(Eq (f r), Eq (Rec f rs)) => Eq (Rec f (r ': rs)) | |
Ord (Rec f ('[] :: [u])) | |
Defined in Data.Vinyl.Core | |
(Ord (f r), Ord (Rec f rs)) => Ord (Rec f (r ': rs)) | |
Defined in Data.Vinyl.Core compare :: Rec f (r ': rs) -> Rec f (r ': rs) -> Ordering # (<) :: Rec f (r ': rs) -> Rec f (r ': rs) -> Bool # (<=) :: Rec f (r ': rs) -> Rec f (r ': rs) -> Bool # (>) :: Rec f (r ': rs) -> Rec f (r ': rs) -> Bool # (>=) :: Rec f (r ': rs) -> Rec f (r ': rs) -> Bool # max :: Rec f (r ': rs) -> Rec f (r ': rs) -> Rec f (r ': rs) # min :: Rec f (r ': rs) -> Rec f (r ': rs) -> Rec f (r ': rs) # | |
(RMap rs, ReifyConstraint Show f rs, RecordToList rs) => Show (Rec f rs) | Records may be shown insofar as their points may be shown.
|
Generic (Rec f ('[] :: [u])) | |
Generic (Rec f rs) => Generic (Rec f (r ': rs)) | |
Semigroup (Rec f ('[] :: [u])) | |
(Semigroup (f r), Semigroup (Rec f rs)) => Semigroup (Rec f (r ': rs)) | |
Monoid (Rec f ('[] :: [u])) | |
(Monoid (f r), Monoid (Rec f rs)) => Monoid (Rec f (r ': rs)) | |
Storable (Rec f ('[] :: [u])) | |
Defined in Data.Vinyl.Core | |
(Storable (f r), Storable (Rec f rs)) => Storable (Rec f (r ': rs)) | |
Defined in Data.Vinyl.Core sizeOf :: Rec f (r ': rs) -> Int # alignment :: Rec f (r ': rs) -> Int # peekElemOff :: Ptr (Rec f (r ': rs)) -> Int -> IO (Rec f (r ': rs)) # pokeElemOff :: Ptr (Rec f (r ': rs)) -> Int -> Rec f (r ': rs) -> IO () # peekByteOff :: Ptr b -> Int -> IO (Rec f (r ': rs)) # pokeByteOff :: Ptr b -> Int -> Rec f (r ': rs) -> IO () # | |
NFData (Rec f ('[] :: [u])) Source # | |
Defined in Frames.ExtraInstances | |
ReifyConstraint NFData f xs => NFData (Rec f xs) | |
Defined in Data.Vinyl.Core | |
type RecSubsetFCtx (Rec :: (k -> Type) -> [k] -> Type) (f :: k -> Type) | |
Defined in Data.Vinyl.Lens | |
type RecSubsetFCtx (Rec :: (k -> Type) -> [k] -> Type) (f :: k -> Type) | |
Defined in Data.Vinyl.Lens | |
type RecElemFCtx (Rec :: (a -> Type) -> [a] -> Type) (f :: a -> Type) | |
Defined in Data.Vinyl.Lens | |
type RecElemFCtx (Rec :: (a -> Type) -> [a] -> Type) (f :: a -> Type) | |
Defined in Data.Vinyl.Lens | |
type Rep (Rec f (r ': rs)) | |
Defined in Data.Vinyl.Core type Rep (Rec f (r ': rs)) = C1 ('MetaCons ":&" ('InfixI 'RightAssociative 7) 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (f r)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rep (Rec f rs))) | |
type Rep (Rec f ('[] :: [u])) | |
Defined in Data.Vinyl.Core |
data ElField (field :: (Symbol, Type)) #
A value with a phantom Symbol
label. It is not a
Haskell Functor
, but it is used in many of the same places a
Functor
is used in vinyl.
Instances
onField :: forall c (ts :: [Type]) b. RPureConstrained c ts => (forall a. (a ∈ ts, c a) => a -> b) -> Field ts -> b #
Apply a type class method to a Field
. Intended for use with
TypeApplications
, e.g. onField @Show show r
.
onCoRec :: forall k1 k2 c f (ts :: [k1]) (b :: k2) g. RPureConstrained c ts => (forall (a :: k1). (a ∈ ts, c a) => f a -> g b) -> CoRec f ts -> g b #
Apply methods from a type class to a CoRec
. Intended for use
with TypeApplications
, e.g. onCoRec @Show show r
rfield :: forall f a b (s :: Symbol). Functor f => (a -> f b) -> ElField '(s, a) -> f (ElField '(s, b)) #
Lens for an ElField'
s data payload.
module Data.Vinyl.Lens
type family RDelete (r :: a) (rs :: [a]) :: [a] where ... #
Remove the first occurence of a type from a type-level list.
type family RecAll (f :: u -> Type) (rs :: [u]) (c :: Type -> Constraint) where ... #
A constraint-former which applies to every field in a record.
type family AllConstrained (c :: u -> Constraint) (ts :: [u]) where ... #
Constraint that all types in a type-level list satisfy a constraint.
AllConstrained (c :: u -> Constraint) ('[] :: [u]) = () | |
AllConstrained (c :: u -> Constraint) (t ': ts :: [u]) = (c t, AllConstrained c ts) |
class AllSatisfied (cs :: k) (t :: k1) #
Constraint that each Constraint in a type-level list is satisfied by a particular type.
Instances
AllSatisfied ('[] :: [k2]) (t :: k1) | |
Defined in Data.Vinyl.TypeLevel | |
(c t, AllSatisfied cs t) => AllSatisfied (c ': cs :: [k -> Constraint]) (t :: k) | |
Defined in Data.Vinyl.TypeLevel |
type family AllAllSat (cs :: k) (ts :: [k1]) where ... #
Constraint that all types in a type-level list satisfy each constraint from a list of constraints.
AllAllSat cs ts
should be equivalent to AllConstrained
(AllSatisfied cs) ts
if partial application of type families were
legal.
AllAllSat (cs :: k1) ('[] :: [k2]) = () | |
AllAllSat (cs :: k1) (t ': ts :: [k2]) = (AllSatisfied cs t, AllAllSat cs ts) |
pattern Col :: KnownSymbol s => t -> ElField '(s, t) Source #
module Frames.ColumnUniverse
readTableMaybe :: (MonadSafe m, ReadRec rs, RMap rs) => FilePath -> Producer (Rec (Maybe :. ElField) rs) m () Source #
Produce rows where any given entry can fail to parse.
pipeTableMaybe :: (Monad m, ReadRec rs, RMap rs) => Pipe [Text] (Rec (Maybe :. ElField) rs) m () Source #
Stream lines of CSV data into rows of ’Rec’ values where any given entry can fail to parse.
readTableOpt :: (MonadSafe m, ReadRec rs, RMap rs) => ParserOptions -> FilePath -> Producer (Record rs) m () Source #
Returns a producer of rows for which each column was successfully parsed.
readTable :: (MonadSafe m, ReadRec rs, RMap rs) => FilePath -> Producer (Record rs) m () Source #
Returns a producer of rows for which each column was successfully parsed.
readTableDebug :: forall m rs. (MonadSafe m, ReadRec rs, RMap rs, RecMapMethod ShowCSV (Either Text :. ElField) rs, RecordToList rs) => FilePath -> Producer (Record rs) m () Source #
Similar to readTable
except that rows that fail to parse are
printed to stderr
with columns that failed to parse printed as
"Left rawtext"
while those that were successfully parsed are
shown as "Right text"
.
pipeTable :: (ReadRec rs, RMap rs, Monad m) => Pipe [Text] (Record rs) m () Source #
Pipe lines of CSV text into rows for which each column was successfully parsed.
module Frames.Exploration
module Frames.Frame
inCoreAoS :: (PrimMonad m, MonadIO m, MonadMask m, RecVec rs) => Producer (Record rs) (SafeT m) () -> m (FrameRec rs) Source #
Stream a finite sequence of rows into an efficient in-memory
representation for further manipulation. Each column of the input
table will be stored optimally based on its type, making use of the
resulting generators a matter of indexing into a densely packed
representation. Returns a Frame
that provides a function to index
into the table.
inCoreAoS' :: (PrimMonad m, MonadIO m, MonadMask m, RecVec rs) => (Rec ((->) Int :. ElField) rs -> Rec ((->) Int :. ElField) ss) -> Producer (Record rs) (SafeT m) () -> m (FrameRec ss) Source #
inCore :: (PrimMonad m, MonadIO m, MonadMask m, RecVec rs, Monad n) => Producer (Record rs) (SafeT m) () -> m (Producer (Record rs) n ()) Source #
Stream a finite sequence of rows into an efficient in-memory representation for further manipulation. Each column of the input table will be stored optimally based on its type, making use of the resulting generator a matter of indexing into a densely packed representation.
inCoreSoA :: (PrimMonad m, MonadIO m, MonadMask m, RecVec rs) => Producer (Record rs) (SafeT m) () -> m (Int, Rec ((->) Int :. ElField) rs) Source #
Stream a finite sequence of rows into an efficient in-memory
representation for further manipulation. Each column of the input
table will be stored optimally based on its type, making use of the
resulting generators a matter of indexing into a densely packed
representation. Returns the number of rows and a record of column
indexing functions. See toAoS
to convert the result to a Frame
which provides an easier-to-use function that indexes into the
table in a row-major fashion.
toAoS :: Int -> Rec ((->) Int :. ElField) rs -> FrameRec rs Source #
Convert a structure-of-arrays to an array-of-structures. This can simplify usage of an in-memory representation.
filterFrame :: RecVec rs => (Record rs -> Bool) -> FrameRec rs -> FrameRec rs Source #
Keep only those rows of a FrameRec
that satisfy a predicate.
module Frames.Joins
meltRow :: (vs ⊆ ts, ss ⊆ ts, vs ~ RDeleteAll ss ts, Disjoint ss ts ~ 'True, ts ≅ (vs ++ ss), ColumnHeaders vs, RowToColumn vs vs) => proxy ss -> Record ts -> [Record (ss ++ '["value" :-> CoRec ElField vs])] Source #
Like melt
in the reshape2
package for the R
language. It
stacks multiple columns into a single column over multiple
rows. Takes a specification of the id columns that remain
unchanged. The remaining columns will be stacked.
Suppose we have a record, r :: Record [Name,Age,Weight]
. If we
apply melt [pr1|Name|] r
, we get two values with type Record
[Name, "value" :-> CoRec Identity [Age,Weight]]
. The first will
contain Age
in the value
column, and the second will contain
Weight
in the value
column.
melt :: forall vs ts ss proxy. (vs ⊆ ts, ss ⊆ ts, vs ~ RDeleteAll ss ts, HasLength vs, Disjoint ss ts ~ 'True, ts ≅ (vs ++ ss), ColumnHeaders vs, RowToColumn vs vs) => proxy ss -> FrameRec ts -> FrameRec (ss ++ '["value" :-> CoRec ElField vs]) Source #
type family RecordColumns t where ... Source #
RecordColumns (Record ts) = ts |
(&:) :: KnownSymbol s => a -> Record rs -> Record ((s :-> a) ': rs) infixr 5 Source #
A cons
function for building Record
values.
recUncons :: Record ((s :-> a) ': rs) -> (a, Record rs) Source #
Separate the first element of a Record
from the rest of the row.
showFields :: (RecMapMethod Show ElField ts, RecordToList ts) => Record ts -> [String] Source #
Show each field of a Record
without its column name.
rgetField :: forall t s a rs. (t ~ '(s, a), t ∈ rs) => Record rs -> a Source #
Get the value of a field of a Record
. This is intended for use
with TypeApplications
, as compared to rgetv
that is intended
for use with OverloadedLabels
.
rputField :: forall t s a rs. (t ~ '(s, a), t ∈ rs, KnownSymbol s) => a -> Record rs -> Record rs Source #
module Frames.RecF
declareColumn :: Text -> Name -> DecsQ Source #
Splice for manually declaring a column of a given type. For
example, declareColumn "x2" ''Double
will declare a type synonym
type X2 = "x2" :-> Double
and a lens x2
.
tableTypes :: String -> FilePath -> DecsQ Source #
Like tableType
, but additionally generates a type synonym for
each column, and a proxy value of that type. If the CSV file has
column names "foo", "bar", and "baz", then this will declare
type Foo = "foo" :-> Int
, for example, foo = rlens @Foo
, and
foo' = rlens' @Foo
.
tableTypes' :: forall a c. (c ~ CoRec ColInfo a, ColumnTypeable c, Monoid c) => RowGen a -> DecsQ Source #
Generate a type for a row of a table. This will be something like
Record ["x" :-> a, "y" :-> b, "z" :-> c]
. Additionally generates
a type synonym for each column, and a proxy value of that type. If
the CSV file has column names "foo", "bar", and "baz", then
this will declare type Foo = "foo" :-> Int
, for example, foo =
rlens @Foo
, and foo' = rlens' @Foo
.
module Frames.TypeLevel
runSafeP :: forall (m :: Type -> Type) r. (MonadMask m, MonadIO m) => Effect (SafeT m) r -> Effect' m r #
runSafeT :: (MonadMask m, MonadIO m) => SafeT m r -> m r #
Run the SafeT
monad transformer, executing all unreleased finalizers at
the end of the computation
data SafeT (m :: Type -> Type) r #
SafeT
is a monad transformer that extends the base monad with the ability
to register
and release
finalizers.
All unreleased finalizers are called at the end of the SafeT
block, even
in the event of exceptions.
Instances
class (MonadCatch m, MonadMask m, MonadIO m, MonadIO (Base m)) => MonadSafe (m :: Type -> Type) #
Instances
MonadSafe m => MonadSafe (CatchT m) | |
(MonadIO m, MonadCatch m, MonadMask m) => MonadSafe (SafeT m) | |
MonadSafe m => MonadSafe (IdentityT m) | |
(MonadSafe m, Monoid w) => MonadSafe (WriterT w m) | |
MonadSafe m => MonadSafe (StateT s m) | |
MonadSafe m => MonadSafe (ReaderT i m) | |
MonadSafe m => MonadSafe (StateT s m) | |
(MonadSafe m, Monoid w) => MonadSafe (WriterT w m) | |
(MonadSafe m, Monoid w) => MonadSafe (RWST i w s m) | |
(MonadSafe m, Monoid w) => MonadSafe (RWST i w s m) | |
MonadSafe m => MonadSafe (Proxy a' a b' b m) | |
runSafeEffect :: (MonadIO m, MonadMask m) => Effect (SafeT m) r -> m r Source #
Run a self-contained ’Pipes.Effect’ and execute the finalizers associated with the ’SafeT’ transformer.