Repository navigation
Replace Backpack with IORef-based app registration - #13
Merged
Merged
Conversation
Backpack doesn't work with Nix: callCabal2nix builds packages as separate derivations, but Backpack instantiation requires both the indefinite library and its instantiation in the same cabal build. Replace the Backpack signature with an IORef registration pattern: - Main library exports MobileApp record type, runMobileApp, getMobileApp - FFI entry points read from a global IORef (Maybe MobileApp) - Desktop: downstream main calls runMobileApp before lifecycle simulation - Android: haskellInit calls runMobileApp via CPP-guarded import - Delete src-sig/HaskellMobile/App.hsig (Backpack signature) - default-app/HaskellMobile/App.hs now exports mobileApp :: MobileApp - haskell-mobile-default-app sub-library now depends on main library - Add -DHASKELL_MOBILE_ANDROID to android.nix GHC flags - Add registration tests for runMobileApp/getMobileApp Prompt: implement plan to replace Backpack with IORef/main registration Tokens: ~60k input, ~10k output Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The iOS and Android nix builds compile HaskellMobile.hs directly with GHC (not via cabal), so default-extensions from the cabal file don't apply. platformLog expects Text, so OverloadedStrings is needed for string literals. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extract MobileApp type into HaskellMobile.Types to break the import cycle between HaskellMobile and HaskellMobile.App in raw-GHC builds (nix/android.nix, nix/ios.nix). Rename CPP flag HASKELL_MOBILE_ANDROID to HASKELL_MOBILE_PLATFORM and add it to the iOS build so haskellInit registers the default app on both platforms, fixing the missing Lifecycle: Create/Resume events in the iOS simulator test. Prompt: PR 13 for haskell-mobile appears to have build failures, here we're replacing backpack with ioref based approach. make sure it builds locally and then ensure CI builds Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
MobileAppregistration pattern, fixing Nix compatibility (callCabal2nixcan't handle Backpack instantiation across derivations)MobileApprecord,runMobileApp,getMobileApp; FFI entry points read from globalIORefHASKELL_MOBILE_ANDROIDto auto-register viahaskellInitTest plan
cabal buildpasses (all libraries + exe)cabal testpasses (27 tests including new registration tests)🤖 Generated with Claude Code