@@ -365,3 +365,24 @@ toSrcType variable = do
365 [ "Problem converting the following type "
365 [ "Problem converting the following type "
366 , "from a type-checker type to a source-syntax type:"
366 , "from a type-checker type to a source-syntax type:"
367 , P.render (pretty Never variable) ]
367 , P.render (pretty Never variable) ]
370+data AppStructure = List Variable | Tuple [Variable] | Other
372+collectApps :: Variable -> IO AppStructure
373+collectApps variable = go [] variable
375+ go vars variable = do
376+ desc <- UF.descriptor variable
377+ case (structure desc, vars) of
378+ (Nothing, [v]) -> case name desc of
379+ Just "_List" -> return (List v)
381+ (Nothing, vs) -> case name desc of
382+ Just ctor | isTuple ctor -> return (Tuple vs)
387+ App1 a b -> go (vars ++ [b]) a