I would like to use the ..
operator for ranges, but I do not want to import all of Data.Array globally. How can I import only ‘…’ from Data.Array?
I tried
import data.Array (..)
and
import data.Array ( .. )
but PureScript doesn’t seem to understand this notation.
Try
import Data.Array ((..))
The parenthesized notation is generally how you refer to operators when they’re not being used infix. That’s also how you pass an operator to a higher-order function like fold (+) 0 [1, 2]
and can be used to apply an operator as a normal non-infix function (..) 1 3 == 1 .. 3
.
1 Like
Aaaah, yes! I read that in “The Book” - but didn’t realise it applies to imports as well. Thanks!