Integrated Dynamics

Integrated Dynamics

63M Downloads

"No-error red cross" when specific constructed operator is applied to `reduce`

met4000 opened this issue ยท 6 comments

commented

Issue type:

  • ๐Ÿ› Bug

Short description:

Applying a specific operator to reduce produces a variable card that displays as a red cross in a display screen (as if errored), but a green tick and a description of the variable is present in the display 'inventory'/right-click UI (see below for pictures).

image image

Similar to #804 in symptoms;

The display panel shows an X but there is no error message; the interface shows a check mark.

However #804 is a different problem; [mis]using pipe with an operator that has 2 inputs instead of 1. I have no idea how it ends up having the same behaviour, but the more info for you, the better I guess :)

Steps to reproduce the problem:

I will try and do some more testing to isolate the problem, but the following Haskell code describes the variable card;

flipPipe :: (b -> c) -> (a -> b) -> (a -> c)
flipPipe = flip pipe

expOpRes :: (a -> (b -> c)) -> (a -> b -> c)
expOpRes = apply flipPipe apply

rotate_2_3 :: (a -> b -> c -> d) -> a -> c -> b -> d
rotate_2_3 = apply flipPipe flip

apply_2_3 :: (z -> a -> b -> c) -> a -> (b -> z -> c)
apply_2_3 = pipe flip rotate_2_3

join :: (a -> a -> b) -> a -> b
join = apply2 pipe2 id id

-- because Haskell doesn't like `-1`
neg1 = 0 - 1


-- Making the operator. Note that type signatures from here on will be bracketed (i.e. operators) as InDy thinks they are, not as they would be in Haskell;

ret1 :: Integer -> Bool -> Integer
ret1 = k


t1 :: Integer -> Integer
t1 = apply (-) neg1

t2 :: Integer -> Integer
t2 = apply (+) neg1   -- equivalent to `decrement`

t3 :: Bool -> (Integer -> Integer)
t3 = apply3 apply_2_3 choice t1 t2

t3_2 :: Bool -> Integer -> Integer
t3_2 = apply expOpRes t3

ret2 :: Integer -> Bool -> Integer
ret2 = flip t3_2


t4 :: Integer -> Bool
t4 = apply (<) neg1

t5 :: Bool -> (Integer -> Bool -> Integer)
t5 = apply3 apply_2_3 choice ret1 ret2

t6 :: Integer -> (Integer -> Bool -> Integer)
t6 = pipe t4 t5

t6_2 :: Integer -> Integer -> (Bool -> Integer)
t6_2 = apply expOpRes t6

reduceOp :: Integer -> (Bool -> Integer)
reduceOp = apply join t6_2

erroringCard = reduce reduceOp [False, True, True, False, False] neg1

When reduceOp has values applied or partially applied to it, it returns the expected values.
erroringCard is the variable card described above; red cross in display panel, without 'actually erroring'. Partially applying reduce with reduceOp also produces the same 'no-error red cross' behaviour, and if that card then has the remaining 2 values applied to it it produces another card also with the same behaviour.

Expected behaviour:

I can apply and/or partially apply reduceOp to reduce without a 'no-error red cross'...?


Versions:

  • Minecraft: 1.12.2
  • Forge: 14.23.5.2852
  • Cyclops Core: 1.12.2-1.6.2
  • ID: 1.12.2-1.1.4
  • ID-Compat: 1.0.0
  • Tunnels: 1.12.2-1.6.11
  • Tunnels-Compat: 1.0.0
commented

When running your world, I see this in the error log:

[20:22:20] [main/ERROR] [Integrated Dynamics]: The input "TOO LONG" could not be parsed for this value type.

This is a known problem, and not easily fixable in this MC version.
I rewrote a bunch of things in MC 1.16, so this problem should not occur anymore there.
Considering this a wont-fix for 1.12.

commented

Thanks for reporting!

commented

Any chance you had this problem with a smaller applied operator?
If not, could you share this world with me?

commented

I'm a bit busy this week, but I'll hopefully be able to do some stuff on or after the weekend.

commented

Created in a clean world (only InDy installed, and no other creations in the world), and it returned the correct value. Went back to the old world, and it's now also returning the correct value; I didn't even touch the setup, the display that previously had the error was now displaying the correct value. Since I now cannot 'reproduce' (for now, at least), I'm not sure what that makes this. I guess this could be closed for now, and if it re-occurs then opened up again? Although the clean world has never had this behaviour occur, I can still send it to you if you have any ideas and want to see if you can reproduce it.

commented

... and I spoke too soon. Did some more of the build I was doing and I got a no-error red cross on the clean world.

CleanWorld.zip (note: the world is called "No-Error Cross" in-game)

The extra stuff is defined with;

t7 :: (b -> a -> b) -> (b -> [a] -> b)
t7 = apply rotate_2_3 reduce

findIndexBool :: [Bool] -> Integer
findIndexBool = apply2 t7 reduceOp neg1

findIndexBool is the one that has this behaviour. It should be the one in a display panel when you load up the world.