Copyright | (C) 2012 Edward Kmett |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | Edward Kmett <ekmett@gmail.com> |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell98 |
- substitute :: (Monad f, Eq a) => a -> f a -> f a -> f a
- substituteVar :: (Functor f, Eq a) => a -> a -> f a -> f a
- isClosed :: Foldable f => f a -> Bool
- closed :: Traversable f => f a -> Maybe (f b)
Documentation
substitute :: (Monad f, Eq a) => a -> f a -> f a -> f a Source
replaces the free variable substitute
a p wa
with p
in w
.
>>>
substitute "hello" ["goodnight","Gracie"] ["hello","!!!"]
["goodnight","Gracie","!!!"]
substituteVar :: (Functor f, Eq a) => a -> a -> f a -> f a Source
replaces a free variable substituteVar
a b wa
with another free variable b
in w
.
>>>
substituteVar "Alice" "Bob" ["Alice","Bob","Charlie"]
["Bob","Bob","Charlie"]
isClosed :: Foldable f => f a -> Bool Source
A closed term has no free variables.
>>>
isClosed []
True
>>>
isClosed [1,2,3]
False
closed :: Traversable f => f a -> Maybe (f b) Source
If a term has no free variables, you can freely change the type of free variables it is parameterized on.
>>>
closed [12]
Nothing
>>>
closed ""
Just []
>>>
:t closed ""
closed "" :: Maybe [b]