elm-lang / elm-reactor

Interactive development tool that makes it easy to develop and debug Elm programs.
BSD 3-Clause "New" or "Revised" License
428 stars 63 forks source link

Console escape codes in HTML output. #162

Closed husio closed 8 years ago

husio commented 8 years ago

When running code using reactor, error reports contains console escape codes. They should either not have any markup or something that makes sense for text/html content type.

Detected errors in 1 module.
[36m-- TYPE MISMATCH ------------------------------------------------------ Main.elm[0m

The argument to function `start` is causing a mismatch.

 7│   start
 8│[31m>[0m    { model = 0
 9│[31m>[0m    , update = update
10│[31m>[0m    , view = view
11│[31m>[0m    }

Function `start` is expecting the argument to be:

    { ...
    , update : CounterList.Action -> [33mnumber[0m -> [33mnumber[0m
    , view : Signal.Address CounterList.Action -> [33mnumber[0m -> Html.Html
    }

But it is:

    { ...
    , update :
          CounterList.Action
          -> [33m{ counters : List ( CounterList.ID, Counter.Model )
          , nextID : CounterList.ID
          }[0m
          -> [33m{ counters : List ( CounterList.ID, Counter.Model )
          , nextID : CounterList.ID
          }[0m
    , view :
          Signal.Address CounterList.Action
          -> [33m{ counters : List ( CounterList.ID, Counter.Model )
          , nextID : CounterList.ID
          }[0m
          -> Html.Html
    }

Similar problem appears when compiling from Vim:

/home/piotr/Elm/Elm-Platform/0.16/.cabal-sandbox/bin//elm-make                                                                                                                                                                    
^[[36m-- TYPE MISMATCH ------------------------------------------------------ Main.elm^[[0m                                                                                                                                       

The argument to function `start` is causing a mismatch.                                                                                                                                                                           

 7│   start                                                                                                                                                                                                                       
 8│^[[31m>^[[0m    { model = 0                                                                                                                                                                                                    
 9│^[[31m>^[[0m    , update = update                                                                                                                                                                                              
10│^[[31m>^[[0m    , view = view                                                                                                                                                                                                  
11│^[[31m>^[[0m    }                                                                                                                                                                                                              

Function `start` is expecting the argument to be:                                                                                                                                                                                 

    { ...                                                                                                                                                                                                                         
    , update : CounterList.Action -> ^[[33mnumber^[[0m -> ^[[33mnumber^[[0m                                                                                                                                                       
    , view : Signal.Address CounterList.Action -> ^[[33mnumber^[[0m -> Html.Html                                                                                                                                                  
    }                                                                                                                                                                                                                             

But it is:                                                                                                                                                                                                                        

    { ...                                                                                                                                                                                                                         
    , update :                                                                                                                                                                                                                    
          CounterList.Action                                                                                                                                                                                                      
          -> ^[[33m{ counters : List ( CounterList.ID, Counter.Model )                                                                                                                                                            
          , nextID : CounterList.ID                                                                                                                                                                                               
          }^[[0m                                                                                                                                                                                                                  
          -> ^[[33m{ counters : List ( CounterList.ID, Counter.Model )                                                                                                                                                            
          , nextID : CounterList.ID                                                                                                                                                                                               
          }^[[0m                                                                                                                                                                                                                  
    , view :                                                                                                                                                                                                                      
          Signal.Address CounterList.Action                                                                                                                                                                                       
          -> ^[[33m{ counters : List ( CounterList.ID, Counter.Model )                                                                                                                                                            
          , nextID : CounterList.ID                                                                                                                                                                                               
          }^[[0m                                                                                                                                                                                                                  
          -> Html.Html                                                                                                                                                                                                            
    }                                                                                                                                                                                                                             

Detected errors in 1 module.      
jvoigtlaender commented 8 years ago

When did you download your installer? What you observe was fixed after the initial release (on Friday, I think), and the old installers were overwritten with fixed ones.

husio commented 8 years ago

Few hours ago. I installed from source, using ghc and cabal. I noticed the same problem using online editor, before the website was down for good.

jvoigtlaender commented 8 years ago

This is the relevant commit: https://github.com/elm-lang/elm-compiler/commit/4a39fdf0a2668459d86d1e45c01b4fec4c6b4dbc.

husio commented 8 years ago

Cool, please close this issue if it's not relevant anymore then.

I'm using 0.16.0, which does not include this patch I guess.

jvoigtlaender commented 8 years ago

From source, did you install master or 0.16 branch? Maybe the commit I mention above was not backported into the 0.16 branch.

About the online editor, yes, it seems Evan forgot to update that one. See https://github.com/elm-lang/elm-lang.org/issues/427#issuecomment-158660239.

jvoigtlaender commented 8 years ago

I don't have the power to close this issue. You have.

husio commented 8 years ago

I was following elm-platform instructions, which in short is:

$ curl https://raw.githubusercontent.com/elm-lang/elm-platform/master/installers/BuildFromSource.hs > BuildFromSource.hs
$ runhaskell BuildFromSource.hs 0.16
jvoigtlaender commented 8 years ago

Yeah. Indeed, the fix is only in master, not in 0.16. @evancz, you probably want to move the 0.16.0 and/or 0.16 tags, because otherwise people building from source will get this buggy behavior in eternity (when installing 0.16).

jvoigtlaender commented 8 years ago

@husio, for the moment, you could simply do runhaskell BuildFromSource.hs master and should get a fixed version.

jvoigtlaender commented 8 years ago

@husio, I think you can close this issue now. Evan moved the tag, so that people installing 0.16 from source will get the fixed behavior.