Comments (6)
Hi Alex, thanks for trying this out and the question.
Something like the following should work.
Working directory (from which you will run your build commands):
~/Documents/code/purescript/purescript-native/ps/
Directory containing your purescript source files (working-dir/src):
~/Documents/code/purescript/purescript-native/ps/src
e.g. ~/Documents/code/purescript/purescript-native/ps/src/hello.purs
The base directory of your Go FFI source trees just go into your working directory. For example, you would do something like
$ cd working-dir
$ git clone https://github.com/andyarvanitis/purescript-native-go-ffi.git
which would result in
~/Documents/code/purescript/purescript-native/ps/purescript-native-go-ffi
which is going to look like
working-dir/purescript-native-go-ffi/README.md
working-dir/purescript-native-go-ffi/src/purescript-arrays
working-dir/purescript-native-go-ffi/src/purescript-assert
working-dir/purescript-native-go-ffi/src/purescript-console
...
You can make also your own FFI directories, just follow a similar structure and put them somewhere under your working directory. Note that there's nothing special about the purescript-native-go-ffi
name.
The psgo
command sets $GOPATH
for you, so you shouldn't need to deal with it. It will search the directory from which you run it for .go
source files in any subdirectories and then set it accordingly.
Let me know if that helps.
-andy
from purescript-native.
Also, I just made an update to psgo
to make it append to any shell GOPATH
(instead of replacing it), in case the user has set it for other Go libraries not under the current working directory.
from purescript-native.
Ok thats all correct I think.
Looking at ST:
purescript-native-go-ffi/src/purescript-st/Control_Monad_ST_Internal.go:4:2: cannot find package "Control_Monad_ST_Internal" in any of:
/usr/local/Cellar/go/1.11.5/libexec/src/Control_Monad_ST_Internal (from $GOROOT)
/Users/mouton/Documents/code/purescript/purescript-native/ps/output/src/Control_Monad_ST_Internal (from $GOPATH)
/Users/mouton/Documents/code/purescript/purescript-native/ps/purescript-native-go-ffi/src/Control_Monad_ST_Internal
Is the correct path ..../ps/purescript-native-go-ffi/src
or ..../ps/purescript-native-go-A ffi/src/purescript-st
?
Any idea where /Control_Monad_ST_Internal suffix coming from?
if i move Control_Monad_ST_Internal.go into ....src/purescript-st/Control_Monad_ST_Internal/ the error goes away.
Thanks
A
from purescript-native.
I think you just need to spago install st
– no need to rearrange anything. Another option is to comment out the purescript-st
FFI "hook" in loader.go
if your program doesn't need it right now. This is because the go FFI files have a dependency on their counterpart purescript packages (this is a Go limitation not found in the C++ backend). I plan to document this sort of thing before I announce the Go backend.
from purescript-native.
(edited) Actually, I think I know of a clean way to get rid of the counterpart dependency unless it's actually needed at runtime. I'll post here if it works well and I check it in.
from purescript-native.
got it working.
Needed to spago install as you said, and filter the loader.go list. thanks!
from purescript-native.
Related Issues (20)
- ObjectUpdate seems to need deep copy HOT 2
- Cannot find ls/ls.h and rs/rs.h HOT 2
- Incorrect equality check in Data_Interval_Duration_Iso HOT 3
- Returning a constant from the ffi HOT 7
- "attribute 'haskell-nix' missing" when building with nix HOT 3
- error building purescript-dotlang HOT 16
- Support spago alternate entry point option
- ffi array type interop with opaque types HOT 7
- zero-fill shift right operator doesn't exist HOT 11
- pass arguments to run HOT 2
- stack nix integration HOT 1
- Problems with nix toolchain HOT 9
- Consider combining executables (and specify backend with switch) HOT 5
- un-gitignore cabal files HOT 2
- cpp binary size HOT 4
- Update to PureScript 0.14 HOT 5
- Webassembly / Emscripten with C++ HOT 1
- Upgrade to Latest PureScript Version
- Backend "psgo" exited with error:1 HOT 2
- go module initialization HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from purescript-native.