flattenFunction _ (Rec _) = error "Recursive binders not supported"
flattenFunction hsfunc bind@(NonRec var expr) =
flattenFunction _ (Rec _) = error "Recursive binders not supported"
flattenFunction hsfunc bind@(NonRec var expr) =
flattenExpr binds lam@(Lam b expr) = do
-- Find the type of the binder
let (arg_ty, _) = Type.splitFunTy (CoreUtils.exprType lam)
-- Create signal names for the binder
flattenExpr binds lam@(Lam b expr) = do
-- Find the type of the binder
let (arg_ty, _) = Type.splitFunTy (CoreUtils.exprType lam)
-- Create signal names for the binder
let binds' = (b, Left defs):binds
(args, res) <- flattenExpr binds' expr
let binds' = (b, Left defs):binds
(args, res) <- flattenExpr binds' expr
-- Check and split each of the arguments
let (_, arg_ress) = unzip (zipWith checkArg args flat_args)
-- Generate signals for our result
-- Check and split each of the arguments
let (_, arg_ress) = unzip (zipWith checkArg args flat_args)
-- Generate signals for our result
-> Var.Var -- The scrutinee
-> CoreBndr -- The binder to bind the scrutinee to
-> CoreAlt -- The single alternative
-> Var.Var -- The scrutinee
-> CoreBndr -- The binder to bind the scrutinee to
-> CoreAlt -- The single alternative
-- See expandExpr
flattenSingleAltCaseExpr binds v b alt@(DataAlt datacon, bind_vars, expr) =
if not (DataCon.isTupleCon datacon)
-- See expandExpr
flattenSingleAltCaseExpr binds v b alt@(DataAlt datacon, bind_vars, expr) =
if not (DataCon.isTupleCon datacon)