Jikka-5.0.11.1: A transpiler from Python to C++ for competitive programming
Copyright(c) Kimiyuki Onaka 2021
LicenseApache License 2.0
Maintainerkimiyuki95@gmail.com
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Jikka.RestrictedPython.Convert.ResolveBuiltin

Description

 
Synopsis

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..