Copyright | (c) Edward Kmett 2011-2012 |
---|---|
License | BSD3 |
Maintainer | Edward Kmett <ekmett@gmail.com> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Meta variables
- data Meta s f a = Meta a Hint !Int !(STRef s (Maybe (f (Meta s f a)))) !(STRef s Depth) !(STRef s Rank)
- metaId :: forall s f a. Lens' (Meta s f a) Int
- metaValue :: forall s f a. Lens' (Meta s f a) a
- metaRef :: forall s f a f. Lens (Meta s f a) (Meta s f a) (STRef s (Maybe (f (Meta s f a)))) (STRef s (Maybe (f (Meta s f a))))
- metaHint :: forall s f a. Lens' (Meta s f a) Hint
- type MetaT s = Meta s (Type (MetaK s)) (KindM s)
- type TypeM s = Type (MetaK s) (MetaT s)
- type MetaK s = Meta s Kind Bool
- type KindM s = Kind (MetaK s)
- type Depth = Int
- metaDepth :: forall s f a. Lens' (Meta s f a) (STRef s Depth)
- depthInf :: Depth
- type Rank = Word
- metaRank :: forall s f a. Lens' (Meta s f a) (STRef s Rank)
- bumpRank :: STRef s Rank -> ST s ()
- newMeta :: MonadMeta s m => a -> Hint -> m (Meta s f a)
- newShallowMeta :: MonadMeta s m => Depth -> a -> Hint -> m (Meta s f a)
- readMeta :: MonadMeta s m => Meta s f a -> m (Maybe (f (Meta s f a)))
- writeMeta :: MonadMeta s m => Meta s f a -> f (Meta s f a) -> m ()
- semiprune :: (Variable f, Monad f, MonadMeta s m) => f (Meta s f a) -> m (f (Meta s f a))
- zonk :: (MonadMeta s m, MonadWriter Any m, Traversable f, Monad f) => f (Meta s f a) -> m (f (Meta s f a))
- zonk_ :: (MonadMeta s m, Traversable f, Monad f) => f (Meta s f a) -> m (f (Meta s f a))
- zonkWith :: (MonadMeta s m, MonadWriter Any m, Traversable f, Monad f) => f (Meta s f a) -> (Meta s f a -> m ()) -> m (f (Meta s f a))
- zonkScope :: (MonadMeta s m, MonadWriter Any m, Traversable f, Monad f) => Scope b f (Meta s f a) -> m (Scope b f (Meta s f a))
- zonkScope_ :: (MonadMeta s m, Traversable f, Monad f) => Scope b f (Meta s f a) -> m (Scope b f (Meta s f a))
- hasSkolems :: (Traversable f, Monad f, MonadMeta s m) => LensLike' m ts (f (Meta s f a)) -> [Meta s f a] -> ts -> m ts
- checkSkolems :: MonadMeta s m => Maybe Depth -> LensLike' m ts (TypeM s) -> [MetaT s] -> ts -> m ts
- checkEscapes :: MonadMeta s m => Depth -> [Meta s f a] -> m ()
- checkDistinct :: (Traversable f, Monad f, Variable f, MonadMeta s m) => [Meta s f a] -> m [Meta s f a]
- data MetaEnv s
- class HasMetaEnv t s | t -> s where
- class (Applicative m, MonadST m, s ~ World m) => MonadMeta s m | m -> s where
- viewMeta :: MonadMeta s m => Getting a (MetaEnv s) a -> m a
- data M s a
- runM :: Rendering -> (forall s. M s a) -> Either Diagnostic a
- runM_ :: Rendering -> (forall s. M s a) -> a
- ioM :: MonadIO m => Rendering -> (forall s. M s a) -> m a
- throwM :: MonadST m => Diagnostic -> m a
- fresh :: MonadMeta s m => m Int
- remember :: MonadMeta s m => Int -> TypeM s -> m ()
Meta variables
A meta variable for skolemization and unification
metaRef :: forall s f a f. Lens (Meta s f a) (Meta s f a) (STRef s (Maybe (f (Meta s f a)))) (STRef s (Maybe (f (Meta s f a)))) Source
Meta Types
Meta Kinds
λ-Depth
Union-By-Rank
Working with Meta
newShallowMeta :: MonadMeta s m => Depth -> a -> Hint -> m (Meta s f a) Source
Construct a new meta variable at a given depth
Pruning
semiprune :: (Variable f, Monad f, MonadMeta s m) => f (Meta s f a) -> m (f (Meta s f a)) Source
Path-compression
zonk :: (MonadMeta s m, MonadWriter Any m, Traversable f, Monad f) => f (Meta s f a) -> m (f (Meta s f a)) Source
Expand meta variables recursively
zonkWith :: (MonadMeta s m, MonadWriter Any m, Traversable f, Monad f) => f (Meta s f a) -> (Meta s f a -> m ()) -> m (f (Meta s f a)) Source
zonkScope :: (MonadMeta s m, MonadWriter Any m, Traversable f, Monad f) => Scope b f (Meta s f a) -> m (Scope b f (Meta s f a)) Source
zonkScope_ :: (MonadMeta s m, Traversable f, Monad f) => Scope b f (Meta s f a) -> m (Scope b f (Meta s f a)) Source
hasSkolems :: (Traversable f, Monad f, MonadMeta s m) => LensLike' m ts (f (Meta s f a)) -> [Meta s f a] -> ts -> m ts Source
Checks if any of the listed skolems exists in the types given in the traversal.
checkSkolems :: MonadMeta s m => Maybe Depth -> LensLike' m ts (TypeM s) -> [MetaT s] -> ts -> m ts Source
Check for escaped Skolem variables in any container full of types.
Dies due to an escaped Skolem or returns the container with all of its types fully zonked.
checkEscapes :: MonadMeta s m => Depth -> [Meta s f a] -> m () Source
Checks if any of the skolems in the list escapes into the context defined by the given depth.
checkDistinct :: (Traversable f, Monad f, Variable f, MonadMeta s m) => [Meta s f a] -> m [Meta s f a] Source
MetaEnv
HasRendering (MetaEnv s) | |
HasMetaEnv (MetaEnv s) s |
class HasMetaEnv t s | t -> s where Source
metaEnv :: Lens' t (MetaEnv s) Source
metaFresh :: Lens' t (STRef s Int) Source
metaMemory :: Lens' t (STRef s (IntMap (TypeM s))) Source
metaRendering :: Lens' t Rendering Source
HasMetaEnv (MetaEnv s) s |
class (Applicative m, MonadST m, s ~ World m) => MonadMeta s m | m -> s where Source
The unification monad
throwM :: MonadST m => Diagnostic -> m a Source
Throw a Diagnostic
error.