encapsulate :: [JavaScript.Statement SourcePos] -- ^type-erased tJS
            -> Env -- ^environment (i.e. exports)
            -> [JavaScript.Statement SourcePos] -- ^contract library
            -> JavaScript.Statement SourcePos -- ^encapsulated module
encapsulate typeErasedStmts env contractLib = wrappedStmts where
  interface = toInterface env
  wrappedStmts = compile typeErasedStmts interface contractLib
encapsulate :: [JavaScript.Statement SourcePos] -- ^type-erased tJS
            -> Env -- ^environment (i.e. exports)
            -> [JavaScript.Statement SourcePos] -- ^contract library
            -> JavaScript.Statement SourcePos
encapsulate typeErasedStmts env contractLib = wrappedStmts where
  interface = toInterface env
  wrappedStmts = compile typeErasedStmts interface contractLib
encapsulate typeErasedStmts env contractLib = wrappedStmts where
  interface = toInterface env
  wrappedStmts = compile typeErasedStmts interface contractLib