Jikka-5.6.0.0: 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.Core.Convert.UnpackTuple

Description

 
Synopsis

Documentation

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

run removes unnecessary introductions and eliminations of tuples. For example, this converts the following:

(fun xs -> (proj0 xs) + (proj1 xs)) (tuple 2 1)

to the follwoing:

(fun x0 x1 -> x0 + x1) 2 1

This can remove 1-tuples over higher-order functions. For example, this converts the following:

foldl (fun xs y -> tuple (proj0 xs + y) (tuple 0) [1, 2, 3]

to the follwoing:

tuple (foldl (fun x y -> x + y) 0 [1, 2, 3])

internal rules