Giter VIP home page Giter VIP logo

Comments (6)

andyarvanitis avatar andyarvanitis commented on June 20, 2024

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.

andyarvanitis avatar andyarvanitis commented on June 20, 2024

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.

AlexMouton avatar AlexMouton commented on June 20, 2024

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.

andyarvanitis avatar andyarvanitis commented on June 20, 2024

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.

andyarvanitis avatar andyarvanitis commented on June 20, 2024

(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.

AlexMouton avatar AlexMouton commented on June 20, 2024

got it working.
Needed to spago install as you said, and filter the loader.go list. thanks!

from purescript-native.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.