Skip to content

Translation to JS fails #66

Open
Open
@tobi512

Description

@tobi512

Hi Atze,
after successfully installing UHC (thanks again for #62), I tried to translate a mid-complex program to JavaScript and ran into multiple error that fail the process.

A simple HelloWorld can be translated without problems and produces very little JavaScript code, which makes UHC very interesting for me. I translated HelloWorld with GHCJS and Fay, both give you an extreme overhead of code...

Error log:
uhc -tjs Ambiguity.hs ParseRE.hs [1/2] Compiling Haskell Ambiguity (Ambiguity.hs) Parse (Haskell syntax) of module 'Ambiguity' *** ERROR *** Ambiguity.hs(1,1): Expecting : CloseBrace or pImportDeclaration or pTopDeclaration or (Symbol symbol ; or Nothing expected ...)* Repaired by: deleting: Symbol symbol {-# at line 1, column 1 of file "Ambiguity.hs" *** ERROR *** Ambiguity.hs(1,20): Expecting : Symbol symbol :: or pPatternConSuffix or pRhs or qconop or varop_no_bang or (pPatternBaseCon ...)* Repaired by: deleting: Symbol symbol #-} at line 1, column 20 of file "Ambiguity.hs" *** ERROR *** Ambiguity.hs(3,1): Expecting : Symbol symbol :: or pRhs or varop_no_bang Repaired by: deleting: SemiColon *** ERROR *** Ambiguity.hs(3,1): Expecting : Symbol symbol :: or pRhs or varop_no_bang Repaired by: deleting: Symbol symbol import at line 3, column 1 of file "Ambiguity.hs" *** ERROR *** Ambiguity.hs(3,8): Expecting : Symbol symbol :: or pRhs or varop_no_bang Repaired by: deleting: Symbol upper case qualified identifier System.Environment at line 3, column 8 of file "Ambiguity.hs" ... and more errors

The first few lines of the file Ambiguity.hs look like this:
{-# LANGUAGE GADTs #-} import System.Environment import Data.List import Data.Maybe import ParseRE

I can send you the 2 files if you want to have a closer look.

System.Environment is used to call getArgs when running the program from the command line, could be changes if this import is a problem.
GADTs are frequently used, is that supported in UHC?!

Many thanks in advance, nice project and great support in here! 😃

Sincerely,
Tobias

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions