Skip to content

Commit

Permalink
Version bump/1.0.0 (#41)
Browse files Browse the repository at this point in the history
* change: haddock @SInCE metadata to semantic versioning
* change: bump cabal version to 1.0.0
  • Loading branch information
riz0id authored Feb 3, 2022
1 parent 70501d0 commit 21337e4
Show file tree
Hide file tree
Showing 49 changed files with 226 additions and 226 deletions.
2 changes: 1 addition & 1 deletion spectacle.cabal
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cabal-version: 2.4

name: spectacle
version: 0.1.0
version: 1.0.0
category: Testing, Concurrency
synopsis: Embedded specification language & model checker in Haskell.
description:
Expand Down
6 changes: 3 additions & 3 deletions src/Control/Applicative/Day.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
--
-- 2. "Notions of Computations as Monoids" <https://arxiv.org/abs/1406.4823>
--
-- @since 0.1.0.0
-- @since 1.0.0
module Control.Applicative.Day
( Day (Day),
getDay,
Expand All @@ -30,12 +30,12 @@ wrapDay ma = Day \mx ->
ma >>= \case
Day k -> k mx

-- | @since 0.1.0.0
-- | @since 1.0.0
instance Functor f => Functor (Day f) where
fmap f (Day xs) = Day (fmap (first f) . xs)
{-# INLINE fmap #-}

-- | @since 0.1.0.0
-- | @since 1.0.0
instance Functor f => Applicative (Day f) where
pure x = Day (fmap (x,))
{-# INLINE pure #-}
Expand Down
8 changes: 4 additions & 4 deletions src/Control/Applicative/Phases.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
--
-- 2. <https://github.com/rampion/tree-traversals>
--
-- @since 0.1.0.0
-- @since 1.0.0
module Control.Applicative.Phases
( Phases (Here, There),
lowerPhases,
Expand All @@ -27,7 +27,7 @@ import Data.Kind (Type)
-- effects of the underlying @f@. The 'Here' constructor apply effects immediately and 'There' constructors
-- incrementally delay effects.
--
-- @since 0.1.0.0
-- @since 1.0.0
data Phases :: (Type -> Type) -> Type -> Type where
Here :: a -> Phases f a
There :: (a -> b -> c) -> f a -> Phases f b -> Phases f c
Expand All @@ -43,13 +43,13 @@ liftPhases :: Monad f => Phases f (f a) -> Phases f a
liftPhases (Here x) = There const x (pure ())
liftPhases (There f x xs) = There const (x >>= \x' -> lowerPhases xs >>= f x') xs

-- | @since 0.1.0.0
-- | @since 1.0.0
instance Functor (Phases f) where
fmap f (Here x) = Here (f x)
fmap f (There op x xs) = There (\y ys -> f (y `op` ys)) x xs
{-# INLINE fmap #-}

-- | @since 0.1.0.0
-- | @since 1.0.0
instance Applicative f => Applicative (Phases f) where
pure = Here
{-# INLINE pure #-}
Expand Down
2 changes: 1 addition & 1 deletion src/Control/Applicative/Queue.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

-- | Effect queues.
--
-- @since 0.1.0.0
-- @since 1.0.0
module Control.Applicative.Queue
( Queue,
runQueue,
Expand Down
14 changes: 7 additions & 7 deletions src/Control/Comonad/Tape.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ import qualified Data.Sequence as Seq
data Tape a = Tape {before :: Seq a, focus :: a, after :: Seq a}
deriving (Eq, Functor, Show)

-- | @since 0.1.0.0
-- | @since 1.0.0
instance Foldable Tape where
foldr cons nil = foldr cons nil . toSeq
{-# INLINE foldr #-}

-- | @since 0.1.0.0
-- | @since 1.0.0
instance Traversable Tape where
traverse f (Tape lower x upper) = Tape <$> traverse f lower <*> f x <*> traverse f upper
{-# INLINE traverse #-}

-- | @since 0.1.0.0
-- | @since 1.0.0
instance Comonad Tape where
extract (Tape _ x _) = x
{-# INLINE extract #-}
Expand All @@ -49,7 +49,7 @@ instance Comonad Tape where
extend f tp = case duplicate tp of
Tape ls x us -> Tape (f <$> ls) (f x) (f <$> us)

-- | @since 0.1.0.0
-- | @since 1.0.0
instance ComonadStore Int Tape where
pos (Tape lw _ _) = length lw
{-# INLINE pos #-}
Expand All @@ -70,22 +70,22 @@ instance ComonadStore Int Tape where

-- | /O(1)/, @'viewl' xs@ constructs a 'Tape' by viewing @xs@ from the left, if it is nonempty.
--
-- @since 0.1.0.0
-- @since 1.0.0
viewl :: Seq a -> Maybe (Tape a)
viewl Empty = Nothing
viewl (x :<| upper) = Just (Tape mempty x upper)

-- | /O(1)/, @'viewl' xs@ constructs a 'Tape' by viewing @xs@ from the left, if it is nonempty.
--
-- @since 0.1.0.0
-- @since 1.0.0
viewr :: Seq a -> Maybe (Tape a)
viewr Empty = Nothing
viewr (lower :|> x) = Just (Tape lower x mempty)

-- | /O(log n)/, @'viewAt' i xs@ constructs a 'Tape' focusing the ith element of @xs@, if it is nonempty. @i@ is
-- clamped to the interval [0, i).
--
-- @since 0.1.0.0
-- @since 1.0.0
viewAt :: Int -> Seq a -> Maybe (Tape a)
viewAt i xs =
case Seq.splitAt i xs of
Expand Down
4 changes: 2 additions & 2 deletions src/Control/Hyper.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

-- | Hyperfunction transformer.
--
-- @since 0.1.0.0
-- @since 1.0.0
module Control.Hyper
( HyperM (HyperM, invokeM),
)
Expand All @@ -21,7 +21,7 @@ import Data.Kind (Type)
newtype HyperM :: (Type -> Type) -> Type -> Type -> Type where
HyperM :: {invokeM :: m ((HyperM m a b -> a) -> b)} -> HyperM m a b

-- | @since 0.1.0.0
-- | @since 1.0.0
instance Monad m => MonadZip (LogicT m) where
mzipWith op (LogicT f) (LogicT g) = LogicT \cons nil ->
let fs x xs = pure (\k -> k (HyperM xs) x)
Expand Down
8 changes: 4 additions & 4 deletions src/Control/Mealy.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

-- |
--
-- @since 0.1.0.0
-- @since 1.0.0
module Control.Mealy
( -- * Mealy Machines
Mealy,
Expand Down Expand Up @@ -39,17 +39,17 @@ type Mealy = MealyM Identity
runMealy :: Mealy a b -> a -> (b, Mealy a b)
runMealy (MealyM k) x = runIdentity (k x)

-- | @since 0.1.0.0
-- | @since 1.0.0
instance (Applicative m, Semigroup b) => Semigroup (MealyM m a b) where
MealyM f <> MealyM g = MealyM \x -> liftA2 (<>) (f x) (g x)
{-# INLINE (<>) #-}

-- | @since 0.1.0.0
-- | @since 1.0.0
instance (Applicative m, Monoid b) => Monoid (MealyM m a b) where
mempty = MealyM \_ -> pure mempty
{-# INLINE mempty #-}

-- | @since 0.1.0.0
-- | @since 1.0.0
instance Applicative m => Applicative (MealyM m a) where
pure x = MealyM \_ -> pure (x, pure x)
{-# INLINE pure #-}
Expand Down
2 changes: 1 addition & 1 deletion src/Control/Monad/Levels.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-- |
--
-- @since 0.1.0.0
-- @since 1.0.0
module Control.Monad.Levels
( -- * Levels
Levels,
Expand Down
26 changes: 13 additions & 13 deletions src/Control/Monad/Levels/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
--
-- 1. Donnacha Oisín Kidney, Nicolas Wu. 2021. Algebras for Weighted Search.
--
-- @since 0.1.0.0
-- @since 1.0.0
module Control.Monad.Levels.Internal
( -- * Levels
Levels,
Expand Down Expand Up @@ -42,12 +42,12 @@ type Levels = LevelsT Identity
runLevels :: Levels a -> (Bag a -> b -> b) -> b -> b
runLevels (LevelsT k) cons nil = runIdentity (k (fmap . cons) (pure nil))

-- | @since 0.1.0.0
-- | @since 1.0.0
instance Foldable Levels where
foldMap f m = runLevels m (mappend . foldMap f) mempty
{-# INLINE foldMap #-}

-- | @since 0.1.0.0
-- | @since 1.0.0
instance Traversable Levels where
traverse f m = runLevels m (liftA2 (<|>) . fmap foldAlt . traverse f) (pure empty)

Expand All @@ -58,7 +58,7 @@ newtype LevelsT :: (Type -> Type) -> Type -> Type where

-- | Constructs a 'LevelsT' with a single level, the monoid provided.
--
-- @since 0.1.0.0
-- @since 1.0.0
foldAlt :: Foldable m => m a -> LevelsT f a
foldAlt xs = LevelsT \cons nil -> cons (foldr Bag.cons Bag.empty xs) nil

Expand All @@ -68,12 +68,12 @@ liftLevelsT xs = LevelsT (\cons nil -> xs >>= \xs' -> runLevelsT xs' cons nil)
wrapLevelsT :: Monad m => m (LevelsT m a) -> LevelsT m a
wrapLevelsT xs = LevelsT (\cons nil -> cons None (xs >>= \xs' -> runLevelsT xs' cons nil))

-- | @since 0.1.0.0
-- | @since 1.0.0
instance Functor (LevelsT m) where
fmap f (LevelsT g) = LevelsT \cons nil -> g (cons . fmap f) nil
{-# INLINE fmap #-}

-- | @since 0.1.0.0
-- | @since 1.0.0
instance Monad m => Applicative (LevelsT m) where
pure x = LevelsT \cons nil -> cons (Bag.singleton x) nil
{-# INLINE pure #-}
Expand All @@ -82,12 +82,12 @@ instance Monad m => Applicative (LevelsT m) where
(<*>) = ap
{-# INLINE (<*>) #-}

-- | @since 0.1.0.0
-- | @since 1.0.0
instance Monad m => Monad (LevelsT m) where
LevelsT m >>= k = liftLevelsT (m (\x xs -> pure (foldr ((<|>) . k) (wrapLevelsT xs) x)) (pure empty))
{-# INLINE (>>=) #-}

-- | @since 0.1.0.0
-- | @since 1.0.0
instance Monad m => Alternative (LevelsT m) where
empty = LevelsT \_ nil -> nil
{-# INLINE empty #-}
Expand All @@ -104,17 +104,17 @@ instance Monad m => Alternative (LevelsT m) where
in f fcons fnil >>= (g gcon (pure gnil) >>=)
{-# INLINE (<|>) #-}

-- | @since 0.1.0.0
-- | @since 1.0.0
instance MonadTrans LevelsT where
lift m = LevelsT \cons nil -> m >>= (`cons` nil) . Bag.singleton
{-# INLINE lift #-}

-- | @since 0.1.0.0
-- | @since 1.0.0
instance MonadState s m => MonadState s (LevelsT m) where
state = lift . state
{-# INLINE state #-}

-- | @since 0.1.0.0
-- | @since 1.0.0
instance MonadReader r m => MonadReader r (LevelsT m) where
reader = lift . reader
{-# INLINE reader #-}
Expand All @@ -123,7 +123,7 @@ instance MonadReader r m => MonadReader r (LevelsT m) where
local f (g cons nil)
{-# INLINE local #-}

-- | @since 0.1.0.0
-- | @since 1.0.0
instance MonadError e m => MonadError e (LevelsT m) where
throwError = lift . throwError
{-# INLINE throwError #-}
Expand All @@ -132,7 +132,7 @@ instance MonadError e m => MonadError e (LevelsT m) where
catchError (f cons nil) (\e -> runLevelsT (g e) cons nil)
{-# INLINE catchError #-}

-- | @since 0.1.0.0
-- | @since 1.0.0
instance MonadIO m => MonadIO (LevelsT m) where
liftIO m = LevelsT \cons nil -> liftIO m >>= (`cons` nil) . Bag.singleton
{-# INLINE liftIO #-}
12 changes: 6 additions & 6 deletions src/Control/Monad/Ref.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-- | State implemented over 'IORef'.
--
-- @since 0.1.0.0
-- @since 1.0.0
module Control.Monad.Ref
( -- * RefM Transformer
RefM (RefM),
Expand All @@ -23,7 +23,7 @@ import Data.IORef (IORef, newIORef, readIORef, writeIORef)
-- In situations where the state @s@ is a large structure which undergoes frequent alteration, 'RefM' can be used as a
-- more preformant alternative to state (assuming its impurity is not a concern).
--
-- @since 0.1.0.0
-- @since 1.0.0
newtype RefM s m a = RefM
{unRefM :: IORef s -> m a}
deriving (Functor)
Expand All @@ -38,7 +38,7 @@ runRefM (RefM k) st = do
execRefM :: MonadIO m => RefM s m a -> s -> m s
execRefM refM st = fst <$> runRefM refM st

-- | @since 0.1.0.0
-- | @since 1.0.0
instance Applicative m => Applicative (RefM s m) where
pure x = RefM \_ -> pure x
{-# INLINE pure #-}
Expand All @@ -47,18 +47,18 @@ instance Applicative m => Applicative (RefM s m) where
f ref <*> m ref
{-# INLINE (<*>) #-}

-- | @since 0.1.0.0
-- | @since 1.0.0
instance Monad m => Monad (RefM s m) where
RefM f >>= m = RefM \ref ->
f ref >>= \x -> unRefM (m x) ref
{-# INLINE (>>=) #-}

-- | @since 0.1.0.0
-- | @since 1.0.0
instance MonadIO m => MonadIO (RefM s m) where
liftIO m = RefM \_ -> liftIO m
{-# INLINE liftIO #-}

-- | @since 0.1.0.0
-- | @since 1.0.0
instance MonadIO m => MonadState s (RefM s m) where
get = RefM (liftIO . readIORef)
{-# INLINE get #-}
Expand Down
Loading

0 comments on commit 21337e4

Please sign in to comment.