markup 0.0.4 → 0.0.5
raw patch · 2 files changed
+35/−39 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Data.Markup.Types: instance Monoid (m a) => Monoid (HostedMarkupT m a)
+ Data.Markup.Types: instance Monoid (m a) => Monoid (InlineMarkupT m a)
+ Data.Markup.Types: instance Monoid (m a) => Monoid (LocalMarkupT m a)
+ Data.Markup.Types: instance Monoid a => Monoid (HostedMarkupM a)
+ Data.Markup.Types: instance Monoid a => Monoid (InlineMarkupM a)
+ Data.Markup.Types: instance Monoid a => Monoid (LocalMarkupM a)
Files
- markup.cabal +9/−9
- src/Data/Markup/Types.hs +26/−30
markup.cabal view
@@ -1,22 +1,22 @@ Name: markup-Version: 0.0.4+Version: 0.0.5 Author: Athan Clark <athan.clark@gmail.com> Maintainer: Athan Clark <athan.clark@gmail.com> License: MIT License-File: LICENSE Synopsis: Abstraction for markup languages Description:- This library tries to make things more uniformly controlled when working with + This library tries to make things more uniformly controlled when working with markup languages in haskell - namely /deployment/ of markup assets. .- Deployment, from this library's perspective, means /how/ something can be - rendered to markup, yet still achieve the same "result" to the end user (namely + Deployment, from this library's perspective, means /how/ something can be+ rendered to markup, yet still achieve the same "result" to the end user (namely the DOM). .- We use monad transformers to infer the deployment mechanism for a context of - markup. The three deployment mechanisms provided include /inline/ (content is - slapped between markup tags), /hosted/ (entirely external - uses raw text as a - url), and /local/ (which uses the <hackage.haskell.org/package/urlpath urlpath> + We use monad transformers to infer the deployment mechanism for a context of+ markup. The three deployment mechanisms provided include /inline/ (content is+ slapped between markup tags), /hosted/ (entirely external - uses raw text as a+ url), and /local/ (which uses the <hackage.haskell.org/package/urlpath urlpath> library to realize what kind of link to create). . As an example, here is remotely hosted image:@@ -24,7 +24,7 @@ > image = deploy Image "foo.png" :: HostedMarkupM (Html ()) > > λ> renderMarkup image- > + > > <img src="foo.png"> . Here is the same example, going relative instead:
src/Data/Markup/Types.hs view
@@ -1,7 +1,9 @@ {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE StandaloneDeriving #-} module Data.Markup.Types where @@ -16,14 +18,9 @@ newtype InlineMarkupT m a = InlineMarkupT { runInlineMarkupT :: m a } deriving (Functor) -instance Applicative f => Applicative (InlineMarkupT f) where- (<*>) f x = InlineMarkupT $- (<*>) (runInlineMarkupT f) $ runInlineMarkupT x--instance Monad m => Monad (InlineMarkupT m) where- return = InlineMarkupT . return- x >>= f = InlineMarkupT $ - runInlineMarkupT x >>= (runInlineMarkupT . f)+deriving instance Monoid (m a) => Monoid (InlineMarkupT m a)+deriving instance Applicative f => Applicative (InlineMarkupT f)+deriving instance Monad m => Monad (InlineMarkupT m) instance MonadTrans InlineMarkupT where lift = InlineMarkupT@@ -31,14 +28,9 @@ newtype HostedMarkupT m a = HostedMarkupT { runHostedMarkupT :: m a } deriving (Functor) -instance Applicative f => Applicative (HostedMarkupT f) where- (<*>) f x = HostedMarkupT $- (<*>) (runHostedMarkupT f) $ runHostedMarkupT x--instance Monad m => Monad (HostedMarkupT m) where- return = HostedMarkupT . return- x >>= f = HostedMarkupT $ - runHostedMarkupT x >>= (runHostedMarkupT . f)+deriving instance Monoid (m a) => Monoid (HostedMarkupT m a)+deriving instance Applicative f => Applicative (HostedMarkupT f)+deriving instance Monad m => Monad (HostedMarkupT m) instance MonadTrans HostedMarkupT where lift = HostedMarkupT@@ -46,14 +38,9 @@ newtype LocalMarkupT m a = LocalMarkupT { runLocalMarkupT :: m a } deriving (Functor) -instance Applicative f => Applicative (LocalMarkupT f) where- (<*>) f x = LocalMarkupT $- (<*>) (runLocalMarkupT f) $ runLocalMarkupT x--instance Monad m => Monad (LocalMarkupT m) where- return = LocalMarkupT . return- x >>= f = LocalMarkupT $ - runLocalMarkupT x >>= (runLocalMarkupT . f)+deriving instance Monoid (m a) => Monoid (LocalMarkupT m a)+deriving instance Applicative f => Applicative (LocalMarkupT f)+deriving instance Monad m => Monad (LocalMarkupT m) instance MonadTrans LocalMarkupT where lift = LocalMarkupT@@ -63,9 +50,12 @@ newtype InlineMarkupM a = InlineMarkupM {runInlineMarkupM :: a} deriving (Functor) +deriving instance Monoid a => Monoid (InlineMarkupM a)+ instance Applicative InlineMarkupM where (<*>) f x = InlineMarkupM $ runInlineMarkupM f (runInlineMarkupM x)+ pure = InlineMarkupM instance Monad InlineMarkupM where return = InlineMarkupM@@ -73,16 +63,19 @@ instance Monad w => Monoid (InlineMarkupM (w a)) where x `mappend` y = InlineMarkupM $ do- (runInlineMarkupM x)- (runInlineMarkupM y)+ runInlineMarkupM x+ runInlineMarkupM y newtype HostedMarkupM a = HostedMarkupM {runHostedMarkupM :: a} deriving (Functor) +deriving instance Monoid a => Monoid (HostedMarkupM a)+ instance Applicative HostedMarkupM where (<*>) f x = HostedMarkupM $ runHostedMarkupM f (runHostedMarkupM x)+ pure = HostedMarkupM instance Monad HostedMarkupM where return = HostedMarkupM@@ -90,16 +83,19 @@ instance Monad w => Monoid (HostedMarkupM (w a)) where x `mappend` y = HostedMarkupM $ do- (runHostedMarkupM x)- (runHostedMarkupM y)+ runHostedMarkupM x+ runHostedMarkupM y newtype LocalMarkupM a = LocalMarkupM {runLocalMarkupM :: a} deriving (Functor) +deriving instance Monoid a => Monoid (LocalMarkupM a)+ instance Applicative LocalMarkupM where (<*>) f x = LocalMarkupM $ runLocalMarkupM f (runLocalMarkupM x)+ pure = LocalMarkupM instance Monad LocalMarkupM where return = LocalMarkupM@@ -107,5 +103,5 @@ instance Monad w => Monoid (LocalMarkupM (w a)) where x `mappend` y = LocalMarkupM $ do- (runLocalMarkupM x)- (runLocalMarkupM y)+ runLocalMarkupM x+ runLocalMarkupM y