forked from purescript/purescript-console
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConsole.purs
More file actions
68 lines (52 loc) · 1.75 KB
/
Copy pathConsole.purs
File metadata and controls
68 lines (52 loc) · 1.75 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
module Effect.Console where
import Effect (Effect)
import Data.Show (class Show, show)
import Data.Unit (Unit)
-- | Write a message to the console.
foreign import log
:: String
-> Effect Unit
-- | Write a value to the console, using its `Show` instance to produce a
-- | `String`.
logShow :: forall a. Show a => a -> Effect Unit
logShow a = log (show a)
-- | Write an warning to the console.
foreign import warn
:: String
-> Effect Unit
-- | Write an warning value to the console, using its `Show` instance to produce
-- | a `String`.
warnShow :: forall a. Show a => a -> Effect Unit
warnShow a = warn (show a)
-- | Write an error to the console.
foreign import error
:: String
-> Effect Unit
-- | Write an error value to the console, using its `Show` instance to produce a
-- | `String`.
errorShow :: forall a. Show a => a -> Effect Unit
errorShow a = error (show a)
-- | Write an info message to the console.
foreign import info
:: String
-> Effect Unit
-- | Write an info value to the console, using its `Show` instance to produce a
-- | `String`.
infoShow :: forall a. Show a => a -> Effect Unit
infoShow a = info (show a)
-- | Write an debug message to the console.
foreign import debug
:: String
-> Effect Unit
-- | Write an debug value to the console, using its `Show` instance to produce a
-- | `String`.
debugShow :: forall a. Show a => a -> Effect Unit
debugShow a = debug (show a)
-- | Start a named timer.
foreign import time :: String -> Effect Unit
-- | Print the time since a named timer started in milliseconds.
foreign import timeLog :: String -> Effect Unit
-- | Stop a named timer and print time since it started in milliseconds.
foreign import timeEnd :: String -> Effect Unit
-- | Clears the console
foreign import clear :: Effect Unit