A while ago I changed meltType to return a "logical melt" which distinguishes between ints as values and ints as tags (as well as errors as tags). This is because relation primops need to sort them differently. Turns out that most of the uses of meltType don't care and convert straight back to the representation type, so it's silly to construct the intermediate logical type. So I hand-specialised the function to generate the types.
simpEvalX was trying to deconstruct and take the arguments of a primitive application at every point. If you had a multiple arguments you would end up trying takePrimApps, then recursing down into the function half, finding another application, and trying to takePrimApps again. Even though the previous one failed. So instead, introduce a function for recursing into applications, which takes the list of arguments you've already seen. Then when you get to the bottom, if it's a primitive you can use the argument list you've built and simplify. Otherwise just rebuild the application.
A while ago I changed
meltType
to return a "logical melt" which distinguishes between ints as values and ints as tags (as well as errors as tags). This is because relation primops need to sort them differently. Turns out that most of the uses ofmeltType
don't care and convert straight back to the representation type, so it's silly to construct the intermediate logical type. So I hand-specialised the function to generate the types.simpEvalX was trying to deconstruct and take the arguments of a primitive application at every point. If you had a multiple arguments you would end up trying
takePrimApps
, then recursing down into the function half, finding another application, and trying totakePrimApps
again. Even though the previous one failed. So instead, introduce a function for recursing into applications, which takes the list of arguments you've already seen. Then when you get to the bottom, if it's a primitive you can use the argument list you've built and simplify. Otherwise just rebuild the application.! @jystic @tranma