Hoogle Search
Within LTS Haskell 24.67 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
-
effectful-core Effectful.Internal.Monad Create an unlifting function with the SeqUnlift strategy. For the general version see withEffToIO. Note: usage of this function is preferrable to withRunInIO because of explicit unlifting strategy and better error reporting.
SeqForkUnlift :: UnliftStrategyeffectful-core Effectful.Internal.Unlift Like SeqUnlift, but all unlifted actions will be executed in a cloned environment. The main consequence is that thread local state is forked at the point of creation of the unlifting function and its modifications in unlifted actions will not affect the main thread of execution (and vice versa):
>>> import Effectful >>> import Effectful.State.Dynamic >>> :{ action :: (IOE :> es, State Int :> es) => Eff es () action = do modify @Int (+1) withEffToIO SeqForkUnlift $ \unlift -> unlift $ modify @Int (+2) modify @Int (+4) :}>>> runEff . execStateLocal @Int 0 $ action 5
>>> runEff . execStateShared @Int 0 $ action 7
Because of this it's possible to safely use the unlifting function outside of the scope of effects it captures, e.g. by creating an IO action that executes effectful operations and running it later:>>> :{ delayed :: UnliftStrategy -> IO (IO String) delayed strategy = runEff . evalStateLocal "Hey" $ do r <- withEffToIO strategy $ \unlift -> pure $ unlift get modify (++ "!!!") pure r :}This doesn't work with the SeqUnlift strategy because when the returned action runs, State is no longer in scope:>>> join $ delayed SeqUnlift *** Exception: version (...) /= storageVersion (0) ...
However, it does with the SeqForkUnlift strategy:>>> join $ delayed SeqForkUnlift "Hey"
-
effectful-core Effectful.Internal.Unlift The sequential strategy is the fastest and a default setting for IOE. Any attempt of calling the unlifting function in threads distinct from its creator will result in a runtime error.
compareQuickly :: Expr -> Expr -> Orderingexpress Data.Express O(n). A fast total order between Exprs that can be used when sorting Expr values. This is lazier than its counterparts compareComplexity and compareLexicographically and tries to evaluate the given Exprs as least as possible.
isEq :: [Expr] -> Expr -> Boolexpress Data.Express O(n+m). Returns whether an Eq instance exists in the given instances list for the given Expr.
> isEq (reifyEqOrd (undefined :: Int)) (val (0::Int)) True
> isEq (reifyEqOrd (undefined :: Int)) (val ([[[0::Int]]])) False
Given that the instances list has length m and that the given Expr has size n, this function is O(n+m).isEqOrd :: [Expr] -> Expr -> Boolexpress Data.Express O(n+m). Returns whether both Eq and Ord instance exist in the given list for the given Expr. Given that the instances list has length m and that the given Expr has size n, this function is O(n+m).
isEqOrdT :: [Expr] -> TypeRep -> Boolexpress Data.Express O(n). Returns whether both Eq and Ord instance exist in the given list for the given TypeRep. Given that the instances list has length n, this function is O(n).
isEqT :: [Expr] -> TypeRep -> Boolexpress Data.Express O(n). Returns whether an Eq instance exists in the given instances list for the given TypeRep.
> isEqT (reifyEqOrd (undefined :: Int)) (typeOf (undefined :: Int)) True
> isEqT (reifyEqOrd (undefined :: Int)) (typeOf (undefined :: [[[Int]]])) False
Given that the instances list has length n, this function is O(n).mkEq :: Typeable a => (a -> a -> Bool) -> [Expr]express Data.Express O(1). Builds a reified Eq instance from the given == function. (cf. reifyEq)
> mkEq ((==) :: Int -> Int -> Bool) [ (==) :: Int -> Int -> Bool , (/=) :: Int -> Int -> Bool ]
mkEquation :: [Expr] -> Expr -> Expr -> Exprexpress Data.Express O(n+m). Returns an equation between two expressions given that it is possible to do so from == operators given in the argument instances list. When not possible, this function returns False encoded as an Expr.