I was trying to compile purescript-unicode
. I had to add some FFI and that was fine. However I got weird errors when it got to compiling/running this piece of code:
bsearch ∷ ∀ a . a -> Array a -> Int -> (a -> a -> Ordering) -> Maybe a bsearch a array size compare = go 0 size where go i k | i > k = Nothing | otherwise = let j = floor (toNumber (i + k) / 2.0) b = unsafePartial (Array.unsafeIndex array j) in case compare a b of EQ -> Just b GT -> go (j + 1) k _ -> go i (j - 1)
The error being:
build project.localhost/purescript-native/output/Main: cannot load project.localhost/purescript-native/output/array: cannot find module providing package project.localhost/purescript-native/output/array
If I rename the variable to anything other than array the error now complains about the new name, e.g.:
build project.localhost/purescript-native/output/Main: cannot load project.localhost/purescript-native/output/otherName: cannot find module providing package project.localhost/purescript-native/output/otherName
The beginning of Data_Char_Unicode_Internal.purs
is this:
// Code generated by psgo. DO NOT EDIT. package Data_Char_Unicode_Internal import . "github.com/purescript-native/go-runtime" import ( "project.localhost/purescript-native/output/Data.Show" "project.localhost/purescript-native/output/Data.Maybe" "project.localhost/purescript-native/output/Data.Boolean" "project.localhost/purescript-native/output/Data.Int" "project.localhost/purescript-native/output/otherName" "project.localhost/purescript-native/output/Data.Ordering" "project.localhost/purescript-native/output/Data.Array" "project.localhost/purescript-native/output/Data.Eq" "project.localhost/purescript-native/output/Data.Functor" )
Note the suspicious
"project.localhost/purescript-native/output/otherName"
When I change the code to not use unsafeIndex
but this:
b = fromMaybe' (\_ -> unsafeCrashWith "Array index out of bounds") (Array.index otherName j)
the build succeeds.
I don't know what this might be but I'm hopeful you might know!
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4