Copyright | (c) 2023 Composewell Technologies |
---|---|
License | BSD3 |
Maintainer | streamly@composewell.com |
Portability | GHC |
Safe Haskell | None |
Language | Haskell2010 |
Streamly.Internal.Data.Path
Contents
Description
Synopsis
- newtype PathException = InvalidPath String
- class IsPath a b where
- unsafeFromPath :: a -> b
- fromPath :: MonadThrow m => a -> m b
- toPath :: b -> a
Exceptions
newtype PathException Source #
Exceptions thrown by path operations.
Constructors
InvalidPath String |
Instances
Exception PathException Source # | |
Defined in Streamly.Internal.Data.Path Methods toException :: PathException -> SomeException # fromException :: SomeException -> Maybe PathException # displayException :: PathException -> String # | |
Show PathException Source # | |
Defined in Streamly.Internal.Data.Path Methods showsPrec :: Int -> PathException -> ShowS # show :: PathException -> String # showList :: [PathException] -> ShowS # | |
Eq PathException Source # | |
Defined in Streamly.Internal.Data.Path Methods (==) :: PathException -> PathException -> Bool # (/=) :: PathException -> PathException -> Bool # |
Conversions
class IsPath a b where Source #
If the type a b
is a member of IsPath
it means we know how to convert
the type b
to and from the base type a
.
Methods
unsafeFromPath :: a -> b Source #
Like fromPath
but does not check the properties of Path
. The user
is responsible to maintain the invariants enforced by the type b
otherwise surprising behavior may result.
This operation provides performance and simplicity when we know that the properties of the path are already verified, for example, when we get the path from the file system or from the OS APIs.
fromPath :: MonadThrow m => a -> m b Source #
Convert a base path type to other forms of well-typed paths. It may fail if the path does not satisfy the properties of the target type.
Convert a well-typed path to the base path type. Never fails.