-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Examples of incorrect output from pretty printer #470
Comments
nested :: Exp (Maybe Bool) -> Exp Int
nested = match \case
Nothing_ -> 0
Just_ False_ -> 1
Just_ True_ -> 2 gives (with a sufficiently narrow terminal to not put it on one line):
EDIT: This has both |
map (\a -> let b = a * a ; c = b * b in T2 c (T3 a b c)) (use (fromList Z [1 :: Float]))
which needs some Also @tmcdonell I'm not sure what's going wrong in your example; is it the |
@tomsmeding Yes, it's the |
EDIT: please see my next message for a smaller repro This one I haven't been able to reproduce with fusion-processed programs, only on the so-called "internal AST". Therefore, a ghci session:
Then: let singleton x = A.use (A.fromList A.Z [x :: Float])
in Sharing.convertAccWith defaultOptions
(let A.T2 a1 (A.T2 a2 (A.T2 a3 _)) = A.T2 (singleton 1) (A.T2 (singleton 2) (A.T2 (singleton 3) (A.lift ())))
in A.zipWith (*) a3 a2)
which contains EDIT: The line starting with |
Smaller reproducing example for the above missing-parentheses issue: T2 (T2 (lift ()) (use (fromList Z [1]))) (use (fromList Z [2])) :: Acc (((), Scalar Float), Scalar Float)
Not sure why I was unable to find this one before. |
Can I petition for a mode in the pretty-printer that attempts to output valid Haskell input code? Having to manually translate a zillion occurrences of |
I think that will be very hard or impossible, as we only have representation types and thus cannot distinguish tuples and shapes. |
A related request, can we have globally unique variable names? That'll make it easier to reason about programs. Currently variables can occur in the left hand side of a let-binding and in its binding, as they have different scopes. By having a separate counter in the pretty printer, to denote the next fresh name, we could have globally unique names. |
Another case where putting multiple things on a single line produces ambiguity: (EDIT: actually, more likely to be a precedence issue somewhere) let a = use (fromList (Z :. (1::Int)) [1.0::Float]) in reshape (I1 (1 - (let I1 x = shape a in x) - (let I1 x = shape a in x))) a
where the This bit me when trying to feed pretty-printed output back into Accelerate :) |
Pretty-printing a single-element tuple is inconsistent between left-hand sides and right-hand sides. This is due to the special cases in prettyAtuple and prettyTuple which are not treated specially in prettyLhs. This results in the situation where the following program: map (\(I1 x) -> I1 x) (map (\x -> I1 x) (use (fromList (Z :. (1 :: Int)) [1::Int]))) is
which is type-incorrect as shown, except if you know that both I petition to change the case for expressions to explicitly write (EDIT: on an unrelated note, why are those maps not fused? Avoiding to fuse maps that don't do work striking again?) |
|
Description
This bug contains some examples where the pretty printer currently generates incorrect or ambiguous results. Please feel free to add new examples as you find them!
Steps to reproduce
Load up the example(s) and
show
them.The text was updated successfully, but these errors were encountered: