tcr / corollary

Cross-compiler from Haskell to Rust, plus parser-haskell.
73 stars 5 forks source link

Print all `where` statements #39

Open tcr opened 7 years ago

tcr commented 7 years ago

There are a few control groups (of do, let, and case) that don't handle where right.

  1. They parse their body as a list of statements and then where, so where first needs to be stripped from the body.
  2. The where clause should be asserted to be the last item in the body.
  3. Then the where clause should have its own parameter in the AST node. Then it should be checked that all of these are printed in main.rs
tcr commented 7 years ago

Another example:

toRustType (IsPtr mut to) = let Rust.TypeName to' = toRustType to in Rust.TypeName (rustMut mut ++ to')
    where
    rustMut Rust.Mutable = "*mut "
    rustMut Rust.Immutable = "*const "