packages feed

ki-unlifted (empty) → 1.0.0

raw patch · 4 files changed

+160/−0 lines, 4 filesdep +basedep +kidep +unliftio-core

Dependencies added: base, ki, unliftio-core

Files

+ CHANGELOG.md view
@@ -0,0 +1,3 @@+## [1.0.0] - 2022-06-30++- Initial release.
+ LICENSE view
@@ -0,0 +1,11 @@+Copyright 2020-2022 Mitchell Rosen, Travis Staton++Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:++1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.++2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.++3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ ki-unlifted.cabal view
@@ -0,0 +1,82 @@+cabal-version: 2.2++author: Mitchell Rosen+bug-reports: https://github.com/awkward-squad/ki/issues+category: Concurrency+copyright: Copyright (C) 2020-2022 Mitchell Rosen, Travis Staton+homepage: https://github.com/awkward-squad/ki+license: BSD-3-Clause+license-file: LICENSE+maintainer: Mitchell Rosen <mitchellwrosen@gmail.com>, Travis Staton <hello@travisstaton.com>+name: ki-unlifted+stability: experimental+synopsis: A lightweight structured-concurrency library+version: 1.0.0++description:+  A lightweight structured-concurrency library.+  .+  For a specialised variant of this API that does not use+  @<https://hackage.haskell.org/package/unliftio-core unliftio-core>@, see+  @<https://hackage.haskell.org/package/ki ki>@.++extra-source-files:+  CHANGELOG.md++source-repository head+  type: git+  location: https://github.com/awkward-squad/ki.git++common component+  build-depends:+    base ^>= 4.12 || ^>= 4.13 || ^>= 4.14 || ^>= 4.15 || ^>= 4.16,+  default-extensions:+    AllowAmbiguousTypes+    BangPatterns+    BlockArguments+    ConstraintKinds+    DeriveAnyClass+    DeriveDataTypeable+    DeriveFunctor+    DeriveGeneric+    DerivingStrategies+    DuplicateRecordFields+    ExistentialQuantification+    GeneralizedNewtypeDeriving+    InstanceSigs+    LambdaCase+    NamedFieldPuns+    NoImplicitPrelude+    NumericUnderscores+    PartialTypeSignatures+    PatternSynonyms+    RankNTypes+    RoleAnnotations+    ScopedTypeVariables+    TypeApplications+    ViewPatterns+  default-language: Haskell2010+  ghc-options:+    -Weverything+    -Wno-all-missed-specialisations+    -Wno-implicit-prelude+    -Wno-missed-specialisations+    -Wno-missing-import-lists+    -Wno-safe+    -Wno-unsafe+  if impl(ghc >= 8.10)+    ghc-options:+      -Wno-missing-safe-haskell-mode+      -Wno-prepositive-qualified-module+  if impl(ghc >= 9.2)+    ghc-options:+      -Wno-missing-kind-signatures++library+  import: component+  build-depends:+    ki ^>= 1.0,+    unliftio-core ^>= 0.2,+  exposed-modules:+    Ki.Unlifted+  hs-source-dirs: src
+ src/Ki/Unlifted.hs view
@@ -0,0 +1,64 @@+-- | The `ki` API, generalized to use 'MonadUnliftIO'.+--+-- __Note__: See @[Ki](https://hackage.haskell.org/package/ki/docs/Ki.html)@ for the main module documentation. Any+-- documentation you see here is incidental, and only a result of re-exporting symbols directly from+-- @[Ki](https://hackage.haskell.org/package/ki/docs/Ki.html)@.+module Ki.Unlifted+  ( Ki.Scope,+    Ki.Thread,+    scoped,+    fork,+    forkTry,+    Ki.await,+    Ki.awaitAll,+    fork_,+    forkWith,+    forkWith_,+    forkTryWith,+    Ki.ThreadOptions (..),+    Ki.defaultThreadOptions,+    Ki.ThreadAffinity (..),+    Ki.ByteCount,+    Ki.kilobytes,+    Ki.megabytes,+  )+where++import Control.Exception (Exception)+import Control.Monad.IO.Unlift (MonadUnliftIO (withRunInIO))+import Data.Void (Void)+import qualified Ki+import Prelude++fork :: forall a m. MonadUnliftIO m => Ki.Scope -> m a -> m (Ki.Thread a)+fork scope action =+  withRunInIO \unlift -> Ki.fork scope (unlift action)++fork_ :: MonadUnliftIO m => Ki.Scope -> m Void -> m ()+fork_ scope action =+  withRunInIO \unlift -> Ki.fork_ scope (unlift action)++forkWith :: forall a m. MonadUnliftIO m => Ki.Scope -> Ki.ThreadOptions -> m a -> m (Ki.Thread a)+forkWith scope opts action =+  withRunInIO \unlift -> Ki.forkWith scope opts (unlift action)++forkWith_ :: MonadUnliftIO m => Ki.Scope -> Ki.ThreadOptions -> m Void -> m ()+forkWith_ scope opts action =+  withRunInIO \unlift -> Ki.forkWith_ scope opts (unlift action)++forkTry :: (Exception e, MonadUnliftIO m) => Ki.Scope -> m a -> m (Ki.Thread (Either e a))+forkTry scope action =+  withRunInIO \unlift -> Ki.forkTry scope (unlift action)++forkTryWith ::+  (Exception e, MonadUnliftIO m) =>+  Ki.Scope ->+  Ki.ThreadOptions ->+  m a ->+  m (Ki.Thread (Either e a))+forkTryWith scope opts action =+  withRunInIO \unlift -> Ki.forkTryWith scope opts (unlift action)++scoped :: forall a m. MonadUnliftIO m => (Ki.Scope -> m a) -> m a+scoped action =+  withRunInIO \unlift -> Ki.scoped \scope -> unlift (action scope)