Last active
September 29, 2019 10:34
-
-
Save mputz86/e608c1c4d3fafe0237e59d53446d5e25 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/ghc-8.4.yaml b/ghc-8.4.yaml | |
index 48f0451..02b772c 100644 | |
--- a/ghc-8.4.yaml | |
+++ b/ghc-8.4.yaml | |
@@ -10,9 +10,6 @@ packages: | |
- examples | |
extra-deps: | |
- # ron: | |
- - transformers-0.5.6.2 | |
- | |
# ron-schema: | |
- hedn-0.2.0.1 | |
diff --git a/ghc-8.4.yaml.lock b/ghc-8.4.yaml.lock | |
index 36f8010..30531e0 100644 | |
--- a/ghc-8.4.yaml.lock | |
+++ b/ghc-8.4.yaml.lock | |
@@ -4,13 +4,6 @@ | |
# https://docs.haskellstack.org/en/stable/lock_files | |
packages: | |
-- completed: | |
- hackage: transformers-0.5.6.2@sha256:6c959d14430f4deffb99579ba019de07c3d852a2122b6f449344386c7d75ff1d,3172 | |
- pantry-tree: | |
- size: 2512 | |
- sha256: c79246ba7d61392c2f214376fed3c2a05e4b2649b93ec2c849a86493f278ace0 | |
- original: | |
- hackage: transformers-0.5.6.2 | |
- completed: | |
hackage: hedn-0.2.0.1@sha256:5fc70a561392a7b740a1e062d358bcbe6affc9501b901b8327e104b9c0fe23f3,2345 | |
pantry-tree: | |
diff --git a/ron-rdt/LICENSE b/ron-rdt/LICENSE | |
deleted file mode 120000 | |
index ea5b606..0000000 | |
--- a/ron-rdt/LICENSE | |
+++ /dev/null | |
@@ -1 +0,0 @@ | |
-../LICENSE | |
\ No newline at end of file | |
diff --git a/ron-rdt/LICENSE b/ron-rdt/LICENSE | |
new file mode 100644 | |
index 0000000..ebca8a7 | |
--- /dev/null | |
+++ b/ron-rdt/LICENSE | |
@@ -0,0 +1,29 @@ | |
+BSD 3-Clause License | |
+ | |
+Copyright (c) 2018, Yuriy Syrovetskiy | |
+All rights reserved. | |
+ | |
+Redistribution and use in source and binary forms, with or without | |
+modification, are permitted provided that the following conditions are met: | |
+ | |
+* Redistributions of source code must retain the above copyright notice, this | |
+ list of conditions and the following disclaimer. | |
+ | |
+* 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. | |
+ | |
+* 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. | |
diff --git a/ron-schema/LICENSE b/ron-schema/LICENSE | |
deleted file mode 120000 | |
index ea5b606..0000000 | |
--- a/ron-schema/LICENSE | |
+++ /dev/null | |
@@ -1 +0,0 @@ | |
-../LICENSE | |
\ No newline at end of file | |
diff --git a/ron-schema/LICENSE b/ron-schema/LICENSE | |
new file mode 100644 | |
index 0000000..ebca8a7 | |
--- /dev/null | |
+++ b/ron-schema/LICENSE | |
@@ -0,0 +1,29 @@ | |
+BSD 3-Clause License | |
+ | |
+Copyright (c) 2018, Yuriy Syrovetskiy | |
+All rights reserved. | |
+ | |
+Redistribution and use in source and binary forms, with or without | |
+modification, are permitted provided that the following conditions are met: | |
+ | |
+* Redistributions of source code must retain the above copyright notice, this | |
+ list of conditions and the following disclaimer. | |
+ | |
+* 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. | |
+ | |
+* 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. | |
diff --git a/ron-storage/LICENSE b/ron-storage/LICENSE | |
deleted file mode 120000 | |
index ea5b606..0000000 | |
--- a/ron-storage/LICENSE | |
+++ /dev/null | |
@@ -1 +0,0 @@ | |
-../LICENSE | |
\ No newline at end of file | |
diff --git a/ron-storage/LICENSE b/ron-storage/LICENSE | |
new file mode 100644 | |
index 0000000..ebca8a7 | |
--- /dev/null | |
+++ b/ron-storage/LICENSE | |
@@ -0,0 +1,29 @@ | |
+BSD 3-Clause License | |
+ | |
+Copyright (c) 2018, Yuriy Syrovetskiy | |
+All rights reserved. | |
+ | |
+Redistribution and use in source and binary forms, with or without | |
+modification, are permitted provided that the following conditions are met: | |
+ | |
+* Redistributions of source code must retain the above copyright notice, this | |
+ list of conditions and the following disclaimer. | |
+ | |
+* 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. | |
+ | |
+* 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. | |
diff --git a/ron/LICENSE b/ron/LICENSE | |
deleted file mode 120000 | |
index ea5b606..0000000 | |
--- a/ron/LICENSE | |
+++ /dev/null | |
@@ -1 +0,0 @@ | |
-../LICENSE | |
\ No newline at end of file | |
diff --git a/ron/LICENSE b/ron/LICENSE | |
new file mode 100644 | |
index 0000000..ebca8a7 | |
--- /dev/null | |
+++ b/ron/LICENSE | |
@@ -0,0 +1,29 @@ | |
+BSD 3-Clause License | |
+ | |
+Copyright (c) 2018, Yuriy Syrovetskiy | |
+All rights reserved. | |
+ | |
+Redistribution and use in source and binary forms, with or without | |
+modification, are permitted provided that the following conditions are met: | |
+ | |
+* Redistributions of source code must retain the above copyright notice, this | |
+ list of conditions and the following disclaimer. | |
+ | |
+* 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. | |
+ | |
+* 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. | |
diff --git a/ron/lib/Control/Monad/Trans/Writer/CPS.hs b/ron/lib/Control/Monad/Trans/Writer/CPS.hs | |
new file mode 100644 | |
index 0000000..1478117 | |
--- /dev/null | |
+++ b/ron/lib/Control/Monad/Trans/Writer/CPS.hs | |
@@ -0,0 +1,285 @@ | |
+{-# LANGUAGE CPP #-} | |
+#if __GLASGOW_HASKELL__ >= 702 | |
+{-# LANGUAGE Safe #-} | |
+#endif | |
+#if __GLASGOW_HASKELL__ >= 710 | |
+{-# LANGUAGE AutoDeriveTypeable #-} | |
+#endif | |
+----------------------------------------------------------------------------- | |
+-- | | |
+-- Module : Control.Monad.Trans.Writer.CPS | |
+-- Copyright : (c) Daniel Mendler 2016, | |
+-- (c) Andy Gill 2001, | |
+-- (c) Oregon Graduate Institute of Science and Technology, 2001 | |
+-- License : BSD-style (see the file LICENSE) | |
+-- | |
+-- Maintainer : R.Paterson@city.ac.uk | |
+-- Stability : experimental | |
+-- Portability : portable | |
+-- | |
+-- The strict 'WriterT' monad transformer, which adds collection of | |
+-- outputs (such as a count or string output) to a given monad. | |
+-- | |
+-- This monad transformer provides only limited access to the output | |
+-- during the computation. For more general access, use | |
+-- "Control.Monad.Trans.State" instead. | |
+-- | |
+-- This version builds its output strictly and uses continuation-passing-style | |
+-- to achieve constant space usage. This transformer can be used as a | |
+-- drop-in replacement for "Control.Monad.Trans.Writer.Strict". | |
+----------------------------------------------------------------------------- | |
+ | |
+module Control.Monad.Trans.Writer.CPS ( | |
+ -- * The Writer monad | |
+ Writer, | |
+ writer, | |
+ runWriter, | |
+ execWriter, | |
+ mapWriter, | |
+ -- * The WriterT monad transformer | |
+ WriterT, | |
+ writerT, | |
+ runWriterT, | |
+ execWriterT, | |
+ mapWriterT, | |
+ -- * Writer operations | |
+ tell, | |
+ listen, | |
+ listens, | |
+ pass, | |
+ censor, | |
+ -- * Lifting other operations | |
+ liftCallCC, | |
+ liftCatch, | |
+ ) where | |
+ | |
+import Prelude | |
+ | |
+import Control.Applicative | |
+import Control.Monad | |
+import Control.Monad.Fix | |
+import Control.Monad.IO.Class | |
+import Control.Monad.Trans.Class | |
+import Control.Monad.Signatures | |
+import Data.Functor.Identity | |
+ | |
+#if !(MIN_VERSION_base(4,8,0)) | |
+import Data.Monoid | |
+#endif | |
+ | |
+#if MIN_VERSION_base(4,9,0) | |
+import qualified Control.Monad.Fail as Fail | |
+#endif | |
+ | |
+-- --------------------------------------------------------------------------- | |
+-- | A writer monad parameterized by the type @w@ of output to accumulate. | |
+-- | |
+-- The 'return' function produces the output 'mempty', while '>>=' | |
+-- combines the outputs of the subcomputations using 'mappend'. | |
+type Writer w = WriterT w Identity | |
+ | |
+-- | Construct a writer computation from a (result, output) pair. | |
+-- (The inverse of 'runWriter'.) | |
+writer :: (Monoid w, Monad m) => (a, w) -> WriterT w m a | |
+writer (a, w') = WriterT $ \ w -> | |
+ let wt = w `mappend` w' in wt `seq` return (a, wt) | |
+{-# INLINE writer #-} | |
+ | |
+-- | Unwrap a writer computation as a (result, output) pair. | |
+-- (The inverse of 'writer'.) | |
+runWriter :: (Monoid w) => Writer w a -> (a, w) | |
+runWriter = runIdentity . runWriterT | |
+{-# INLINE runWriter #-} | |
+ | |
+-- | Extract the output from a writer computation. | |
+-- | |
+-- * @'execWriter' m = 'snd' ('runWriter' m)@ | |
+execWriter :: (Monoid w) => Writer w a -> w | |
+execWriter = runIdentity . execWriterT | |
+{-# INLINE execWriter #-} | |
+ | |
+-- | Map both the return value and output of a computation using | |
+-- the given function. | |
+-- | |
+-- * @'runWriter' ('mapWriter' f m) = f ('runWriter' m)@ | |
+mapWriter :: (Monoid w, Monoid w') => | |
+ ((a, w) -> (b, w')) -> Writer w a -> Writer w' b | |
+mapWriter f = mapWriterT (Identity . f . runIdentity) | |
+{-# INLINE mapWriter #-} | |
+ | |
+-- --------------------------------------------------------------------------- | |
+-- | A writer monad parameterized by: | |
+-- | |
+-- * @w@ - the output to accumulate. | |
+-- | |
+-- * @m@ - The inner monad. | |
+-- | |
+-- The 'return' function produces the output 'mempty', while '>>=' | |
+-- combines the outputs of the subcomputations using 'mappend'. | |
+ | |
+newtype WriterT w m a = WriterT { unWriterT :: w -> m (a, w) } | |
+ | |
+-- | Construct a writer computation from a (result, output) computation. | |
+-- (The inverse of 'runWriterT'.) | |
+writerT :: (Functor m, Monoid w) => m (a, w) -> WriterT w m a | |
+writerT f = WriterT $ \ w -> | |
+ (\ (a, w') -> let wt = w `mappend` w' in wt `seq` (a, wt)) <$> f | |
+{-# INLINE writerT #-} | |
+ | |
+-- | Unwrap a writer computation. | |
+-- (The inverse of 'writerT'.) | |
+runWriterT :: (Monoid w) => WriterT w m a -> m (a, w) | |
+runWriterT m = unWriterT m mempty | |
+{-# INLINE runWriterT #-} | |
+ | |
+-- | Extract the output from a writer computation. | |
+-- | |
+-- * @'execWriterT' m = 'liftM' 'snd' ('runWriterT' m)@ | |
+execWriterT :: (Monad m, Monoid w) => WriterT w m a -> m w | |
+execWriterT m = do | |
+ (_, w) <- runWriterT m | |
+ return w | |
+{-# INLINE execWriterT #-} | |
+ | |
+-- | Map both the return value and output of a computation using | |
+-- the given function. | |
+-- | |
+-- * @'runWriterT' ('mapWriterT' f m) = f ('runWriterT' m)@ | |
+mapWriterT :: (Monad n, Monoid w, Monoid w') => | |
+ (m (a, w) -> n (b, w')) -> WriterT w m a -> WriterT w' n b | |
+mapWriterT f m = WriterT $ \ w -> do | |
+ (a, w') <- f (runWriterT m) | |
+ let wt = w `mappend` w' | |
+ wt `seq` return (a, wt) | |
+{-# INLINE mapWriterT #-} | |
+ | |
+instance (Functor m) => Functor (WriterT w m) where | |
+ fmap f m = WriterT $ \ w -> (\ (a, w') -> (f a, w')) <$> unWriterT m w | |
+ {-# INLINE fmap #-} | |
+ | |
+instance (Functor m, Monad m) => Applicative (WriterT w m) where | |
+ pure a = WriterT $ \ w -> return (a, w) | |
+ {-# INLINE pure #-} | |
+ | |
+ WriterT mf <*> WriterT mx = WriterT $ \ w -> do | |
+ (f, w') <- mf w | |
+ (x, w'') <- mx w' | |
+ return (f x, w'') | |
+ {-# INLINE (<*>) #-} | |
+ | |
+instance (Functor m, MonadPlus m) => Alternative (WriterT w m) where | |
+ empty = WriterT $ const mzero | |
+ {-# INLINE empty #-} | |
+ | |
+ WriterT m <|> WriterT n = WriterT $ \ w -> m w `mplus` n w | |
+ {-# INLINE (<|>) #-} | |
+ | |
+instance (Monad m) => Monad (WriterT w m) where | |
+#if !(MIN_VERSION_base(4,8,0)) | |
+ return a = WriterT $ \ w -> return (a, w) | |
+ {-# INLINE return #-} | |
+#endif | |
+ | |
+ m >>= k = WriterT $ \ w -> do | |
+ (a, w') <- unWriterT m w | |
+ unWriterT (k a) w' | |
+ {-# INLINE (>>=) #-} | |
+ | |
+#if !(MIN_VERSION_base(4,13,0)) | |
+ fail msg = WriterT $ \ _ -> fail msg | |
+ {-# INLINE fail #-} | |
+#endif | |
+ | |
+#if MIN_VERSION_base(4,9,0) | |
+instance (Fail.MonadFail m) => Fail.MonadFail (WriterT w m) where | |
+ fail msg = WriterT $ \ _ -> Fail.fail msg | |
+ {-# INLINE fail #-} | |
+#endif | |
+ | |
+instance (Functor m, MonadPlus m) => MonadPlus (WriterT w m) where | |
+ mzero = empty | |
+ {-# INLINE mzero #-} | |
+ mplus = (<|>) | |
+ {-# INLINE mplus #-} | |
+ | |
+instance (MonadFix m) => MonadFix (WriterT w m) where | |
+ mfix f = WriterT $ \ w -> mfix $ \ ~(a, _) -> unWriterT (f a) w | |
+ {-# INLINE mfix #-} | |
+ | |
+instance MonadTrans (WriterT w) where | |
+ lift m = WriterT $ \ w -> do | |
+ a <- m | |
+ return (a, w) | |
+ {-# INLINE lift #-} | |
+ | |
+instance (MonadIO m) => MonadIO (WriterT w m) where | |
+ liftIO = lift . liftIO | |
+ {-# INLINE liftIO #-} | |
+ | |
+-- | @'tell' w@ is an action that produces the output @w@. | |
+tell :: (Monoid w, Monad m) => w -> WriterT w m () | |
+tell w = writer ((), w) | |
+{-# INLINE tell #-} | |
+ | |
+-- | @'listen' m@ is an action that executes the action @m@ and adds its | |
+-- output to the value of the computation. | |
+-- | |
+-- * @'runWriterT' ('listen' m) = 'liftM' (\\ (a, w) -> ((a, w), w)) ('runWriterT' m)@ | |
+listen :: (Monoid w, Monad m) => WriterT w m a -> WriterT w m (a, w) | |
+listen = listens id | |
+{-# INLINE listen #-} | |
+ | |
+-- | @'listens' f m@ is an action that executes the action @m@ and adds | |
+-- the result of applying @f@ to the output to the value of the computation. | |
+-- | |
+-- * @'listens' f m = 'liftM' (id *** f) ('listen' m)@ | |
+-- | |
+-- * @'runWriterT' ('listens' f m) = 'liftM' (\\ (a, w) -> ((a, f w), w)) ('runWriterT' m)@ | |
+listens :: (Monoid w, Monad m) => | |
+ (w -> b) -> WriterT w m a -> WriterT w m (a, b) | |
+listens f m = WriterT $ \ w -> do | |
+ (a, w') <- runWriterT m | |
+ let wt = w `mappend` w' | |
+ wt `seq` return ((a, f w'), wt) | |
+{-# INLINE listens #-} | |
+ | |
+-- | @'pass' m@ is an action that executes the action @m@, which returns | |
+-- a value and a function, and returns the value, applying the function | |
+-- to the output. | |
+-- | |
+-- * @'runWriterT' ('pass' m) = 'liftM' (\\ ((a, f), w) -> (a, f w)) ('runWriterT' m)@ | |
+pass :: (Monoid w, Monoid w', Monad m) => | |
+ WriterT w m (a, w -> w') -> WriterT w' m a | |
+pass m = WriterT $ \ w -> do | |
+ ((a, f), w') <- runWriterT m | |
+ let wt = w `mappend` f w' | |
+ wt `seq` return (a, wt) | |
+{-# INLINE pass #-} | |
+ | |
+-- | @'censor' f m@ is an action that executes the action @m@ and | |
+-- applies the function @f@ to its output, leaving the return value | |
+-- unchanged. | |
+-- | |
+-- * @'censor' f m = 'pass' ('liftM' (\\ x -> (x,f)) m)@ | |
+-- | |
+-- * @'runWriterT' ('censor' f m) = 'liftM' (\\ (a, w) -> (a, f w)) ('runWriterT' m)@ | |
+censor :: (Monoid w, Monad m) => (w -> w) -> WriterT w m a -> WriterT w m a | |
+censor f m = WriterT $ \ w -> do | |
+ (a, w') <- runWriterT m | |
+ let wt = w `mappend` f w' | |
+ wt `seq` return (a, wt) | |
+{-# INLINE censor #-} | |
+ | |
+-- | Uniform lifting of a @callCC@ operation to the new monad. | |
+-- This version rolls back to the original state on entering the | |
+-- continuation. | |
+liftCallCC :: CallCC m (a, w) (b, w) -> CallCC (WriterT w m) a b | |
+liftCallCC callCC f = WriterT $ \ w -> | |
+ callCC $ \ c -> unWriterT (f (\ a -> WriterT $ \ _ -> c (a, w))) w | |
+{-# INLINE liftCallCC #-} | |
+ | |
+-- | Lift a @catchE@ operation to the new monad. | |
+liftCatch :: Catch e m (a, w) -> Catch e (WriterT w m) a | |
+liftCatch catchE m h = WriterT $ \ w -> | |
+ unWriterT m w `catchE` \ e -> unWriterT (h e) w | |
+{-# INLINE liftCatch #-} | |
diff --git a/ron/ron.cabal b/ron/ron.cabal | |
index 1dc6591..91dde07 100644 | |
--- a/ron/ron.cabal | |
+++ b/ron/ron.cabal | |
@@ -30,6 +30,7 @@ common language | |
library | |
import: language | |
build-depends: | |
+ base, | |
aeson, | |
attoparsec, | |
binary, | |
@@ -41,8 +42,7 @@ library | |
template-haskell, | |
text, | |
time, | |
- transformers >= 0.5.6.0, | |
- -- ^ Writer.CPS | |
+ transformers, | |
unordered-containers | |
exposed-modules: | |
RON.Base64 | |
@@ -66,6 +66,7 @@ library | |
RON.UUID | |
other-modules: | |
Attoparsec.Extra | |
+ Control.Monad.Trans.Writer.CPS | |
Data.ZigZag | |
RON.Prelude.Writer | |
hs-source-dirs: lib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/.gitignore b/.gitignore | |
index 896277e..6197088 100644 | |
--- a/.gitignore | |
+++ b/.gitignore | |
@@ -1,4 +1,3 @@ | |
-*.cabal | |
.stack-work/ | |
dist/* | |
cabal-dev/* | |
diff --git a/hedn-functor/hedn-functor.cabal b/hedn-functor/hedn-functor.cabal | |
new file mode 100644 | |
index 0000000..720c2af | |
--- /dev/null | |
+++ b/hedn-functor/hedn-functor.cabal | |
@@ -0,0 +1,45 @@ | |
+cabal-version: 1.12 | |
+ | |
+-- This file has been generated from package.yaml by hpack version 0.31.2. | |
+-- | |
+-- see: https://github.com/sol/hpack | |
+-- | |
+-- hash: 1cbb3031d66621dd3df2ffb5ddcc3f8008ea5b198546c92e34ada8841fb71403 | |
+ | |
+name: hedn-functor | |
+version: 0.1.0.0 | |
+synopsis: Base functor for EDN AST | |
+description: Functor encoding for recursion schemes. | |
+ . | |
+ Mini-tutorial is available on package page: <https://dpwiz.gitlab.io/hedn/05-BaseFunctor.html>. | |
+category: Data | |
+author: Alexander Bondarenko | |
+maintainer: aenor.realm@gmail.com | |
+copyright: (c) 2019 Alexander Bondarenko | |
+license: BSD3 | |
+license-file: LICENSE | |
+build-type: Simple | |
+extra-source-files: | |
+ CHANGELOG.md | |
+ LICENSE | |
+ | |
+source-repository head | |
+ type: git | |
+ location: https://gitlab.com/dpwiz/hedn | |
+ | |
+library | |
+ exposed-modules: | |
+ Data.Functor.Base.EDN | |
+ other-modules: | |
+ Paths_hedn_functor | |
+ hs-source-dirs: | |
+ lib | |
+ ghc-options: -Wall | |
+ build-depends: | |
+ base >=4.9 && <4.13 | |
+ , containers >=0.5.7 && <0.7 | |
+ , hedn | |
+ , recursion-schemes >=5.0.1 && <6 | |
+ , text >=1.2 && <2 | |
+ , vector >=0.11 && <1 | |
+ default-language: Haskell2010 | |
diff --git a/hedn-functor/package.yaml b/hedn-functor/package.yaml | |
deleted file mode 100644 | |
index 08ebbc7..0000000 | |
--- a/hedn-functor/package.yaml | |
+++ /dev/null | |
@@ -1,35 +0,0 @@ | |
-name: hedn-functor | |
-version: '0.1.0.0' | |
- | |
-license: BSD3 | |
-license-file: LICENSE | |
-author: Alexander Bondarenko | |
-maintainer: aenor.realm@gmail.com | |
-copyright: (c) 2019 Alexander Bondarenko | |
- | |
-category: Data | |
-synopsis: Base functor for EDN AST | |
-description: | | |
- Functor encoding for recursion schemes. | |
- . | |
- Mini-tutorial is available on package page: <https://dpwiz.gitlab.io/hedn/05-BaseFunctor.html>. | |
- | |
-git: https://gitlab.com/dpwiz/hedn | |
- | |
-ghc-options: -Wall | |
- | |
-dependencies: | |
- base: ">= 4.9 && < 4.13" | |
- containers: ">= 0.5.7 && < 0.7" | |
- recursion-schemes: ">= 5.0.1 && < 6" | |
- text: ">= 1.2 && < 2" | |
- vector: ">= 0.11 && < 1" | |
- | |
-library: | |
- source-dirs: lib | |
- dependencies: | |
- - hedn | |
- | |
-extra-source-files: | |
-- CHANGELOG.md | |
-- LICENSE | |
diff --git a/hedn/hedn.cabal b/hedn/hedn.cabal | |
new file mode 100644 | |
index 0000000..bc47d9b | |
--- /dev/null | |
+++ b/hedn/hedn.cabal | |
@@ -0,0 +1,88 @@ | |
+cabal-version: 1.12 | |
+ | |
+-- This file has been generated from package.yaml by hpack version 0.31.2. | |
+-- | |
+-- see: https://github.com/sol/hpack | |
+-- | |
+-- hash: a706d4137b744310da23c675144dc82ad82bc8468f9560f195f74d0c8558c9a2 | |
+ | |
+name: hedn | |
+version: 0.2.0.1 | |
+synopsis: EDN parsing and encoding | |
+description: A EDN parsing and encoding library. | |
+ . | |
+ Based on "specs" published at <https://github.com/edn-format/edn>. | |
+category: Data | |
+author: Alexander Bondarenko | |
+maintainer: aenor.realm@gmail.com | |
+copyright: (c) 2019 Alexander Bondarenko | |
+license: BSD3 | |
+license-file: LICENSE | |
+tested-with: GHC==8.0.1, GHC==8.2.2, GHC==8.4.4, GHC==8.6.3 | |
+build-type: Simple | |
+extra-source-files: | |
+ CHANGELOG.md | |
+ LICENSE | |
+ README.md | |
+ | |
+source-repository head | |
+ type: git | |
+ location: https://gitlab.com/dpwiz/hedn | |
+ | |
+library | |
+ exposed-modules: | |
+ Data.EDN | |
+ Data.EDN.AST.Lexer | |
+ Data.EDN.AST.Parser | |
+ Data.EDN.AST.Printer | |
+ Data.EDN.AST.Types | |
+ Data.EDN.AST.Types.Tagged | |
+ Data.EDN.AST.Types.Value | |
+ Data.EDN.Class | |
+ Data.EDN.Class.Parser | |
+ Data.EDN.QQ | |
+ other-modules: | |
+ Paths_hedn | |
+ hs-source-dirs: | |
+ lib | |
+ ghc-options: -Wall | |
+ build-depends: | |
+ base >=4.9 && <4.13 | |
+ , containers >=0.5.7 && <0.7 | |
+ , deepseq >=1.4 && <2 | |
+ , deriving-compat >=0.3.6 && <0.6 | |
+ , megaparsec >=7.0 && <8 | |
+ , parser-combinators >=1.0 && <2 | |
+ , prettyprinter >=1.2 && <2 | |
+ , scientific >=0.3 && <0.4 | |
+ , template-haskell >=2.11 && <3 | |
+ , text >=1.2 && <2 | |
+ , time >=1.6 && <2 | |
+ , uuid-types >=1.0 && <2 | |
+ , vector >=0.11 && <1 | |
+ default-language: Haskell2010 | |
+ | |
+test-suite edn-test | |
+ type: exitcode-stdio-1.0 | |
+ main-is: Main.hs | |
+ other-modules: | |
+ Data.EDN.AST.Gen | |
+ Data.EDN.AST.Test | |
+ Data.EDN.Class.Gen | |
+ Data.EDN.Class.Test | |
+ Data.EDN.QQ.Test | |
+ Paths_hedn | |
+ hs-source-dirs: | |
+ tests | |
+ ghc-options: -Wall | |
+ build-depends: | |
+ base >=4.9 && <4.13 | |
+ , containers >=0.5.7 && <0.7 | |
+ , hedgehog >=0.6 && <2 | |
+ , hedn >=0.2 && <1 | |
+ , megaparsec >=7.0 && <8 | |
+ , text >=1.2 && <2 | |
+ , time >=1.6 && <2 | |
+ , uuid-types >=1.0 && <2 | |
+ , vector >=0.11 && <1 | |
+ default-language: Haskell2010 | |
diff --git a/hedn/package.yaml b/hedn/package.yaml | |
deleted file mode 100644 | |
index 7058d5e..0000000 | |
--- a/hedn/package.yaml | |
+++ /dev/null | |
@@ -1,53 +0,0 @@ | |
-name: hedn | |
-version: '0.2.0.1' | |
- | |
-license: BSD3 | |
-license-file: LICENSE | |
-author: Alexander Bondarenko | |
-maintainer: aenor.realm@gmail.com | |
-copyright: (c) 2019 Alexander Bondarenko | |
- | |
-category: Data | |
-synopsis: EDN parsing and encoding | |
-description: | | |
- A EDN parsing and encoding library. | |
- . | |
- Based on "specs" published at <https://github.com/edn-format/edn>. | |
- | |
-git: https://gitlab.com/dpwiz/hedn | |
- | |
-ghc-options: -Wall | |
- | |
-tested-with: GHC==8.0.1, GHC==8.2.2, GHC==8.4.4, GHC==8.6.3 | |
- | |
-dependencies: | |
- base: ">= 4.9 && < 4.13" | |
- containers: ">= 0.5.7 && < 0.7" | |
- megaparsec: ">= 7.0 && < 8" | |
- text: ">= 1.2 && < 2" | |
- time: ">= 1.6 && < 2" | |
- uuid-types: ">= 1.0 && < 2" | |
- vector: ">= 0.11 && < 1" | |
- | |
-library: | |
- source-dirs: lib | |
- dependencies: | |
- deepseq: ">= 1.4 && < 2" | |
- deriving-compat: ">= 0.3.6 && < 0.6" | |
- parser-combinators: ">= 1.0 && < 2" | |
- prettyprinter: ">= 1.2 && < 2" | |
- scientific: ">= 0.3 && < 0.4" | |
- template-haskell: ">= 2.11 && < 3" | |
- | |
-tests: | |
- edn-test: | |
- source-dirs: tests | |
- main: Main.hs | |
- dependencies: | |
- hedn: ">= 0.2 && < 1" | |
- hedgehog: ">= 0.6 && < 2" | |
- | |
-extra-source-files: | |
-- CHANGELOG.md | |
-- LICENSE | |
-- README.md | |
diff --git a/package.yaml b/package.yaml | |
deleted file mode 120000 | |
index 6a57963..0000000 | |
--- a/package.yaml | |
+++ /dev/null | |
@@ -1 +0,0 @@ | |
-hedn/package.yaml | |
\ No newline at end of file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment