             escapedLine = line.replace(/"/g, '\\"')
             options.model.interpret escapedLine
               .map (e) ->
+                type: 'success'
                 input: line
                 code: e.msg[0]
                 highlightInformation: e.msg[1]
+              .catch (e) ->
+                error =
+                  input: line
+                  type: 'error'
+                  message: e.message
+                  warnings: e.warnings
+                Rx.Observable.just error
           .scan ((acc, x) -> [x].concat acc), []
           .startWith []
 

  '-webkit-font-feature-settings': webkitFontFeatureSettings
  'font-family': fontFamily

REPLCycle =
  # highlight : forall a.
  #   { code : String, highlightInformation : HighlightInformation } ->
  #   CycleDOM
  highlight: ({ code, highlightInformation }) ->
    highlights = highlighter.highlight code, highlightInformation
    highlighter.highlightToCycle highlights

  # view : Observable State -> Observable CycleDOM
  view: (state$) ->
    styles = fontOptions()

    state$.map (lines) ->
      lines = lines.map (line) ->
        highlightedCode = REPLCycle.highlight line
        CycleDOM.h 'div',
          {
            className: 'idris-repl-line'

Cycle = require '@cycle/core'
CycleDOM = require '@cycle/dom'
highlighter = require '../utils/highlighter'
Rx = require 'rx-lite'

fontOptions = () ->
  fontSize = atom.config.get 'language-idris.panelFontSize'
