/
Range.purs
173 lines (116 loc) · 5.05 KB
/
Range.purs
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
module Ace.Range
( clipRows
, clone
, collapseRows
, compare
, compareEnd
, compareInside
, comparePoint
, compareRange
, compareStart
, contains
, containsRange
, create
, extend
, fromPoints
, getEnd
, getEndRow
, getEndColumn
, getStartColumn
, getStartRow
, getStart
, inside
, insideEnd
, insideStart
, intersects
, isEmpty
, isEnd
, isEqual
, isMultiLine
, isStart
, setEnd
, setStart
, toScreenRange
, toString
) where
import Prelude hiding (compare)
import Ace.Types (Range, EditSession, Position)
import Effect (Effect)
import Data.Function.Uncurried (Fn2, runFn2, Fn3, runFn3, Fn4, runFn4)
foreign import getStartRow :: Range -> Effect Int
foreign import getStartColumn :: Range -> Effect Int
foreign import getEndRow :: Range -> Effect Int
foreign import getEndColumn :: Range -> Effect Int
foreign import getStart :: Range -> Effect Position
foreign import getEnd :: Range -> Effect Position
foreign import isEmpty :: Range -> Effect Boolean
foreign import isEqualImpl :: Fn2 Range Range (Effect Unit)
isEqual :: Range -> Range -> Effect Unit
isEqual range self = runFn2 isEqualImpl range self
foreign import toString :: Range -> Effect Unit
foreign import containsImpl :: Fn3 Int Int Range (Effect Boolean)
contains :: Int -> Int -> Range -> Effect Boolean
contains row column self = runFn3 containsImpl row column self
foreign import compareRangeImpl :: Fn2 Range Range (Effect Int)
compareRange :: Range -> Range -> Effect Int
compareRange range self = runFn2 compareRangeImpl range self
foreign import comparePointImpl :: Fn2 Range Range (Effect Int)
comparePoint :: Range -> Range -> Effect Int
comparePoint p self = runFn2 comparePointImpl p self
foreign import containsRangeImpl :: Fn2 Range Range (Effect Boolean)
containsRange :: Range -> Range -> Effect Boolean
containsRange range self = runFn2 containsRangeImpl range self
foreign import intersectsImpl :: Fn2 Range Range (Effect Boolean)
intersects :: Range -> Range -> Effect Boolean
intersects range self = runFn2 intersectsImpl range self
foreign import isEndImpl :: Fn3 Int Int Range (Effect Boolean)
isEnd :: Int -> Int -> Range -> Effect Boolean
isEnd row column self = runFn3 isEndImpl row column self
foreign import isStartImpl :: Fn3 Int Int Range (Effect Boolean)
isStart :: Int -> Int -> Range -> Effect Boolean
isStart row column self = runFn3 isStartImpl row column self
foreign import setStartImpl :: Fn3 Int Int Range (Effect Unit)
setStart :: Int -> Int -> Range -> Effect Unit
setStart row column self = runFn3 setStartImpl row column self
foreign import setEndImpl :: Fn3 Int Int Range (Effect Unit)
setEnd :: Int -> Int -> Range -> Effect Unit
setEnd row column self = runFn3 setEndImpl row column self
foreign import insideImpl :: Fn3 Int Int Range (Effect Boolean)
inside :: Int -> Int -> Range -> Effect Boolean
inside row column self = runFn3 insideImpl row column self
foreign import insideStartImpl :: Fn3 Int Int Range (Effect Boolean)
insideStart :: Int -> Int -> Range -> Effect Boolean
insideStart row column self = runFn3 insideStartImpl row column self
foreign import insideEndImpl :: Fn3 Int Int Range (Effect Boolean)
insideEnd :: Int -> Int -> Range -> Effect Boolean
insideEnd row column self = runFn3 insideEndImpl row column self
foreign import compareImpl :: Fn3 Int Int Range (Effect Int)
compare :: Int -> Int -> Range -> Effect Int
compare row column self = runFn3 compareImpl row column self
foreign import compareStartImpl :: Fn3 Int Int Range (Effect Int)
compareStart :: Int -> Int -> Range -> Effect Int
compareStart row column self = runFn3 compareStartImpl row column self
foreign import compareEndImpl :: Fn3 Int Int Range (Effect Int)
compareEnd :: Int -> Int -> Range -> Effect Int
compareEnd row column self = runFn3 compareEndImpl row column self
foreign import compareInsideImpl :: Fn3 Int Int Range (Effect Int)
compareInside :: Int -> Int -> Range -> Effect Int
compareInside row column self = runFn3 compareInsideImpl row column self
foreign import clipRowsImpl :: Fn3 Int Int Range (Effect Range)
clipRows :: Int -> Int -> Range -> Effect Range
clipRows firstRow lastRow self = runFn3 clipRowsImpl firstRow lastRow self
foreign import extendImpl :: Fn3 Int Int Range (Effect Range)
extend :: Int -> Int -> Range -> Effect Range
extend row column self = runFn3 extendImpl row column self
foreign import isMultiLine :: Range -> Effect Boolean
foreign import clone :: Range -> Effect Range
foreign import collapseRows :: Range -> Effect Range
foreign import toScreenRangeImpl :: Fn2 EditSession Range (Effect Range)
toScreenRange :: EditSession -> Range -> Effect Range
toScreenRange session self = runFn2 toScreenRangeImpl session self
foreign import fromPointsImpl :: Fn2 Range Range (Effect Range)
fromPoints :: Range -> Range -> Effect Range
fromPoints start end = runFn2 fromPointsImpl start end
foreign import createImpl :: Fn4 Int Int Int Int (Effect Range)
create :: Int -> Int -> Int -> Int -> Effect Range
create startRow startColumn endRow endColumn = runFn4 createImpl startRow startColumn endRow endColumn