-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add example to probe purescript-refs C FFI
- Loading branch information
Showing
4 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module Main where | ||
|
||
import Prelude | ||
|
||
import Effect (Effect) | ||
import Effect.Console as Console | ||
import Effect.Ref as Ref | ||
|
||
main :: Effect Unit | ||
main = do | ||
ref <- Ref.new "new" | ||
run "Ref.new" =<< Ref.read ref | ||
Ref.modify_ (const "modify_") ref | ||
run "Ref.modify_" =<< Ref.read ref | ||
Ref.write "write" ref | ||
run "Ref.write" =<< Ref.read ref | ||
where | ||
run label result = | ||
Console.log $ | ||
"[" <> label <> "]: " <> show result |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
default: main | ||
.PHONY: default | ||
|
||
PUREC_DIR := ../.. | ||
export PATH := $(PUREC_DIR)/node_modules/.bin:$(PATH) | ||
include $(PUREC_DIR)/mk/target.mk | ||
|
||
SHELL := /bin/bash | ||
srcs := . | ||
deps := $(shell\ | ||
find ../bower_components/purescript-{control,effect,prelude,console,refs}/src/\ | ||
-type f\ | ||
-name '*.purs') | ||
$(eval $(call purs_mk_target,main,Main,$(srcs),$(deps))) |
This file contains 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