Copyright | (c) Kimiyuki Onaka 2021 |
---|---|

License | Apache License 2.0 |

Maintainer | kimiyuki95@gmail.com |

Stability | experimental |

Portability | portable |

Safe Haskell | None |

Language | Haskell2010 |

## Synopsis

- run :: (MonadAlpha m, MonadError Error m) => Program -> m Program

# Documentation

run :: (MonadAlpha m, MonadError Error m) => Program -> m Program Source #

`run`

resolves types of polymorphic builtin functions.
This assumes there are no assignments to builtin functions, i.e. `doesntHaveAssignmentToBuiltin`

.

For example, the `max`

of `max(xs)`

has a type \(\mathbf{list}(\alpha) \to \alpha\) but the `max`

of `max(x, y, z)`

has a type \(\alpha \times \alpha \times \alpha \to \alpha\).
So this function converts `Var "max"`

to `BuiltinMax1 t`

, `BuiltinMax t 2`

, `BuiltinMax t 3`

, etc..