diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,34 @@
+Copyright (c) 2022 Torsten Schmits
+
+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.
+
+Subject to the terms and conditions of this license, each copyright holder and contributor hereby grants to those
+receiving rights under this license a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except
+for failure to satisfy the conditions of this license) patent license to make, have made, use, offer to sell, sell,
+import, and otherwise transfer this software, where such license applies only to those patent claims, already acquired
+or hereafter acquired, licensable by such copyright holder or contributor that are necessarily infringed by:
+
+  (a) their Contribution(s) (the licensed copyrights of copyright holders and non-copyrightable additions of
+  contributors, in source or binary form) alone; or
+  (b) combination of their Contribution(s) with the work of authorship to which such Contribution(s) was added by such
+  copyright holder or contributor, if, at the time the Contribution is added, such addition causes such combination to
+  be necessarily infringed. The patent license shall not apply to any other combinations which include the Contribution.
+
+Except as expressly stated above, no rights or licenses from any copyright holder or contributor is granted under this
+license, whether expressly, by implication, estoppel or otherwise.
+
+DISCLAIMER
+
+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 HOLDERS 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.
diff --git a/Setup.hs b/Setup.hs
new file mode 100644
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/lib/Prelate.hs b/lib/Prelate.hs
new file mode 100644
--- /dev/null
+++ b/lib/Prelate.hs
@@ -0,0 +1,3 @@
+module Prelate (module Prelate.Prelude) where
+
+import Prelate.Prelude
diff --git a/lib/Prelate/Atomic.hs b/lib/Prelate/Atomic.hs
new file mode 100644
--- /dev/null
+++ b/lib/Prelate/Atomic.hs
@@ -0,0 +1,20 @@
+module Prelate.Atomic where
+
+import Incipit (AtomicState, Member, Sem, atomicGets, atomicModify')
+import Lens.Micro (Lens', (.~))
+import Lens.Micro.Extras (view)
+
+atomicSet ::
+  Member (AtomicState s) r =>
+  Lens' s a ->
+  a ->
+  Sem r ()
+atomicSet l a =
+  atomicModify' (l .~ a)
+
+atomicView ::
+  Member (AtomicState s) r =>
+  Lens' s a ->
+  Sem r a
+atomicView l =
+  atomicGets (view l)
diff --git a/lib/Prelate/Control/Monad.hs b/lib/Prelate/Control/Monad.hs
new file mode 100644
--- /dev/null
+++ b/lib/Prelate/Control/Monad.hs
@@ -0,0 +1,27 @@
+module Prelate.Control.Monad (
+  module Prelate.Control.Monad,
+  module Control.Monad.Extra,
+) where
+
+import Control.Monad.Extra (
+  findM,
+  firstJustM,
+  pureIf,
+  untilJustM,
+  whenJust,
+  whenJustM,
+  whenMaybe,
+  whenMaybeM,
+  whileJustM,
+  whileM,
+  )
+
+-- |Call a side-effecting function on a value and return the value.
+tap ::
+  Functor m =>
+  (a -> m ()) ->
+  a ->
+  m a
+tap f a =
+  a <$ f a
+{-# inline tap #-}
diff --git a/lib/Prelate/Data/Maybe.hs b/lib/Prelate/Data/Maybe.hs
new file mode 100644
--- /dev/null
+++ b/lib/Prelate/Data/Maybe.hs
@@ -0,0 +1,20 @@
+module Prelate.Data.Maybe where
+
+-- |Return 'Just' if the condition is 'True'.
+justIf ::
+  Bool ->
+  a ->
+  Maybe a
+justIf cond a =
+  if cond then Just a else Nothing
+{-# inline justIf #-}
+
+-- |Version of 'maybe' that takes an action as fallback.
+fromMaybeA ::
+  Applicative m =>
+  m a ->
+  Maybe a ->
+  m a
+fromMaybeA fallback =
+  maybe fallback pure
+{-# inline fromMaybeA #-}
diff --git a/lib/Prelate/Json.hs b/lib/Prelate/Json.hs
new file mode 100644
--- /dev/null
+++ b/lib/Prelate/Json.hs
@@ -0,0 +1,26 @@
+module Prelate.Json (
+  json,
+  unaryJson,
+) where
+
+import qualified Data.Aeson as Aeson
+import Data.Aeson.TH (deriveJSON)
+import Data.Generics.Labels ()
+import Data.List (dropWhileEnd)
+import qualified Language.Haskell.TH.Syntax as TH
+
+
+-- |Aeson codec options that remove leading and trailing underscores.
+basicOptions :: Aeson.Options
+basicOptions =
+  Aeson.defaultOptions { Aeson.fieldLabelModifier = dropWhileEnd ('_' ==) . dropWhile ('_' ==) }
+
+-- |Derive Aeson codecs that strip underscores and unwrap data/newtype with single fields.
+json :: TH.Name -> TH.Q [TH.Dec]
+json =
+  deriveJSON basicOptions { Aeson.unwrapUnaryRecords = True }
+
+-- |Derive Aeson codecs that strip underscores.
+unaryJson :: TH.Name -> TH.Q [TH.Dec]
+unaryJson =
+  deriveJSON basicOptions
diff --git a/lib/Prelate/Prelude.hs b/lib/Prelate/Prelude.hs
new file mode 100644
--- /dev/null
+++ b/lib/Prelate/Prelude.hs
@@ -0,0 +1,26 @@
+module Prelate.Prelude (
+  module Incipit,
+  module Prelate.Prelude,
+  module Prelate.Atomic,
+  module Prelate.Control.Monad,
+  module Prelate.Data.Maybe,
+  module Prelate.Json,
+  module Data.Aeson,
+  module Lens.Micro,
+  module Lens.Micro.GHC,
+) where
+
+import Data.Aeson (FromJSON, ToJSON)
+import Data.Generics.Labels ()
+import Incipit
+import Lens.Micro hiding (lens)
+import Lens.Micro.GHC (at)
+
+import Prelate.Atomic
+import Prelate.Control.Monad
+import Prelate.Data.Maybe
+import Prelate.Json
+
+-- |Alias for 'Tagged'.
+type a @@ b =
+  Tagged b a
diff --git a/lib/Process.hs b/lib/Process.hs
new file mode 100644
--- /dev/null
+++ b/lib/Process.hs
@@ -0,0 +1,5 @@
+module Process (
+  module Polysemy.Process
+) where
+
+import Polysemy.Process
diff --git a/prelate.cabal b/prelate.cabal
new file mode 100644
--- /dev/null
+++ b/prelate.cabal
@@ -0,0 +1,159 @@
+cabal-version: 2.2
+
+-- This file has been generated from package.yaml by hpack version 0.34.7.
+--
+-- see: https://github.com/sol/hpack
+
+name:           prelate
+version:        0.1.0.0
+synopsis:       A Prelude
+description:    See https://hackage.haskell.org/package/prelate/docs/Prelate.html
+category:       Prelude
+homepage:       https://github.com/tek/prelate#readme
+bug-reports:    https://github.com/tek/prelate/issues
+author:         Torsten Schmits
+maintainer:     hackage@tryp.io
+copyright:      2022 Torsten Schmits
+license:        BSD-2-Clause-Patent
+license-file:   LICENSE
+build-type:     Simple
+
+source-repository head
+  type: git
+  location: https://github.com/tek/prelate
+
+library
+  exposed-modules:
+      Prelate
+      Prelate.Atomic
+      Prelate.Control.Monad
+      Prelate.Data.Maybe
+      Prelate.Json
+      Prelate.Prelude
+      Process
+  reexported-modules:
+      Control.Concurrent.STM
+    , Control.Concurrent.STM.TArray
+    , Control.Concurrent.STM.TBQueue
+    , Control.Concurrent.STM.TChan
+    , Control.Concurrent.STM.TMVar
+    , Control.Concurrent.STM.TQueue
+    , Control.Concurrent.STM.TSem
+    , Control.Concurrent.STM.TVar
+    , Control.Monad.STM
+    , Data.ByteString
+    , Data.ByteString.Builder
+    , Data.ByteString.Lazy
+    , Data.ByteString.Short
+    , Data.IntMap.Lazy
+    , Data.IntMap.Strict
+    , Data.IntSet
+    , Data.Map.Lazy
+    , Data.Map.Strict
+    , Data.Sequence
+    , Data.Set
+    , Data.Text
+    , Data.Text.IO
+    , Data.Text.Lazy
+    , Data.Text.Lazy.Builder
+    , Data.Text.Lazy.IO
+    , Data.Text.Read
+    , Data.Tree
+    , Exon
+    , Lens.Micro
+    , Lens.Micro.GHC
+    , Polysemy.Chronos
+    , Polysemy.Conc
+    , Polysemy.Conc.Queue
+    , Polysemy.Conc.Sync
+    , Polysemy.Log
+    , Polysemy.Process
+    , Polysemy.Resume
+    , Polysemy.Time
+    , Conc
+    , Log
+    , Queue
+    , Sync
+    , Time
+  hs-source-dirs:
+      lib
+  default-extensions:
+      AllowAmbiguousTypes
+      ApplicativeDo
+      BangPatterns
+      BinaryLiterals
+      BlockArguments
+      ConstraintKinds
+      DataKinds
+      DefaultSignatures
+      DeriveAnyClass
+      DeriveDataTypeable
+      DeriveFoldable
+      DeriveFunctor
+      DeriveGeneric
+      DeriveLift
+      DeriveTraversable
+      DerivingStrategies
+      DerivingVia
+      DisambiguateRecordFields
+      DoAndIfThenElse
+      DuplicateRecordFields
+      EmptyCase
+      EmptyDataDecls
+      ExistentialQuantification
+      FlexibleContexts
+      FlexibleInstances
+      FunctionalDependencies
+      GADTs
+      GeneralizedNewtypeDeriving
+      InstanceSigs
+      KindSignatures
+      LambdaCase
+      LiberalTypeSynonyms
+      MultiParamTypeClasses
+      MultiWayIf
+      NamedFieldPuns
+      OverloadedLabels
+      OverloadedLists
+      OverloadedStrings
+      PackageImports
+      PartialTypeSignatures
+      PatternGuards
+      PatternSynonyms
+      PolyKinds
+      QuantifiedConstraints
+      QuasiQuotes
+      RankNTypes
+      RecordWildCards
+      RecursiveDo
+      RoleAnnotations
+      ScopedTypeVariables
+      StandaloneDeriving
+      TemplateHaskell
+      TupleSections
+      TypeApplications
+      TypeFamilies
+      TypeFamilyDependencies
+      TypeOperators
+      TypeSynonymInstances
+      UndecidableInstances
+      UnicodeSyntax
+      ViewPatterns
+  ghc-options: -Wall -Wredundant-constraints -Wincomplete-uni-patterns -Wmissing-deriving-strategies -Widentities -Wunused-packages
+  build-depends:
+      aeson >=2.0
+    , base >=4.13 && <4.17
+    , exon >=1.0.1
+    , extra >=1.7.10
+    , generic-lens >=2.2
+    , incipit >=0.3
+    , microlens >=0.4
+    , microlens-ghc >=0.4
+    , polysemy-chronos >=0.5
+    , polysemy-conc >=0.9
+    , polysemy-log >=0.7
+    , polysemy-process >=0.9
+    , polysemy-resume >=0.5
+    , polysemy-time >=0.5
+    , template-haskell
+  default-language: Haskell2010
