tcr / corollary

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

let-defined lambas are generated wrong. #49

Closed tcr closed 7 years ago

tcr commented 7 years ago

Search for these two lines and you'll see they are generated improperly (not as top-level fns, but like two inline lambas in a let statement)

    let isDefault (Just condition) = Left condition
        isDefault Nothing = Right ()
tcr commented 7 years ago

This converts to this, when it should convert into one overloaded function.

    pub fn interpretStatement(next: String) -> String {
        /* do */ {
            let isDefault = |Some(condition)| {
                Left(condition)
            };

            let isDefault = |None| {
                Right(())
            };

        }
    }