diff --git a/src/Control/Lazy.purs b/src/Control/Lazy.purs index 3434d09..6b736a5 100644 --- a/src/Control/Lazy.purs +++ b/src/Control/Lazy.purs @@ -19,6 +19,17 @@ instance lazyUnit :: Lazy Unit where -- | `fix` defines a value as the fixed point of a function. -- | -- | The `Lazy` instance allows us to generate the result lazily. +-- | +-- | Example: +-- | ```purs +-- | fib :: Int -> Int +-- | fib = fix go +-- | where +-- | go :: (Int -> Int) -> Int -> Int +-- | go _ 0 = 0 +-- | go _ 1 = 1 +-- | go f n = f (n - 1) + f (n - 2) +-- | ``` fix :: forall l. Lazy l => (l -> l) -> l fix f = go where