ermine-0.6: Ermine

Copyright(c) Edward Kmett and Dan Doel 2012-2013
LicenseBSD3
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Ermine.Unification.Sharing

Description

These combinators can be used to retain sharing information.

Synopsis

Documentation

runSharing :: Monad m => a -> SharingT m a -> m a Source

Run an action, if it returns Any True then use its new value, otherwise use the passed in value.

This can be used to recover sharing during unification when no interesting unification takes place.

This version discards the SharingT wrapper.

withSharing :: Monad m => (a -> SharingT m a) -> a -> m a Source

sharing :: MonadWriter Any m => a -> m a -> m a Source

Run an action, if it returns Any True then use its new value, otherwise use the passed in value.

This can be used to recover sharing during unification when no interesting unification takes place.

This version retains the current monad wrapper.

newtype SharingT m a Source

Constructors

SharingT 

Fields

unsharingT :: m (Shared a)
 

Instances

MonadTrans SharingT 
MonadState s m => MonadState s (SharingT m) 
MonadReader e m => MonadReader e (SharingT m) 
Monad m => MonadWriter Any (SharingT m) 
MonadMeta s m => MonadMeta s (SharingT m) 
Monad m => Monad (SharingT m) 
Monad m => Functor (SharingT m) 
Monad m => Applicative (SharingT m) 
MonadIO m => MonadIO (SharingT m) 
Typeable ((* -> *) -> * -> *) SharingT 

data Shared a Source

Constructors

Shared !Bool a 

Instances

Functor Shared 
Foldable Shared 
Traversable Shared 
Comonad Shared 
Eq a => Eq (Shared a) 
Data a => Data (Shared a) 
Ord a => Ord (Shared a) 
Read a => Read (Shared a) 
Show a => Show (Shared a) 
Typeable (* -> *) Shared 

uncaring :: Functor m => SharingT m a -> m () Source