-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEditorBasic.purs
More file actions
53 lines (45 loc) · 1.43 KB
/
EditorBasic.purs
File metadata and controls
53 lines (45 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
module EditorBasic where
import Control.Monad.Aff (Aff)
import Control.Monad.Aff (Aff, launchAff_)
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Class (liftEff)
import Control.Monad.Eff.Exception (EXCEPTION)
import Control.Monad.Eff.Exception (EXCEPTION, Error)
import DOM (DOM)
import DOM.Node.Types (ElementId(..))
import Data.Maybe (Maybe(..))
import Debug.Trace (traceAnyM, trace)
import Monaco.Editor as ME
import Monaco.Types (MONACO)
import Monaco.Types as MT
import Prelude (Unit, bind, pure, unit, ($))
import Utils as U
import Utils as U
editor ∷ forall e. Aff (monaco :: MONACO, dom ∷ DOM, exception ∷ EXCEPTION |e) Unit
editor = do
mbEl <- liftEff (U.getElementById $ ElementId "line")
case mbEl of
Nothing -> pure unit
Just el -> do
let options =
MT.defaultConstuctorOptions
{ value = Just "function x() {\n\tconsole.log(\"Hello world!\");\n}"
, language = Just "javascript"
, theme = Just "vs-dark"
, fontWeight = Just MT.fontWeightBolder
, fontSize = Just 16.0
}
let e = ME.create options el
let x = trace "Hey"
ch <- e
_ <- traceAnyM ch
pure unit
main
∷ forall e
. Eff ( dom ∷ DOM
, monaco :: MONACO
, exception ∷ EXCEPTION, exception ∷ EXCEPTION
| e )
Unit
main = U.onLoad do
launchAff_ editor