-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
The first choice to make for the direction of the tutorial is whether to let GHC or swiftc build the final executable. I chose to let Xcode and swiftc build the executable, but having GHC link to a Swift framework might be a good choice too. Reasons to embed the Haskell library include
- GHC linking will probably change less than Swift in the future. Swift is likely to change as its ABI story progresses.
- Xcode automatically bundles the right Swift dylibs for you.
- Xcode is always updated with all app bundle features (icons, signing, Info.plist editor).
- Xcode knows exactly how all the Swift code is built and can provide correct code completion and debugging.
- If Haskell is being used as a backend for a Swift frontend, being able to directly call into linked Haskell functions is probably more useful than the reverse.
- I've embedded Haskell libraries before.
Reasons not to:
- Dynamic library dependencies need to be chased and copied to the bundle. If GHC builds the executable, it can link them all statically. This is solvable with tooling like
cabal-macosx. - Haskell can't call directly into the app's Swift functions by linking. (Although it can still call system frameworks.)
The Xcode project currently includes stack build as a build script phase, but this could be inverted by having Setup.hs call xcodebuild.
The tutorial currently only covers passing integers from Swift to Haskell, but I'd like to also cover passing bytestrings and functions in both directions.
Metadata
Metadata
Assignees
Labels
No labels