Last active
August 29, 2015 13:56
-
-
Save dysinger/9300540 to your computer and use it in GitHub Desktop.
Some Errors with the Idris JS Codegen? Am I doing it wrong?
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
module Main | |
data Cloud : Type where | |
AWS : Ptr -> Cloud | |
data Service : Type where | |
S3 : Ptr -> Service | |
amazonCloud : IO Cloud | |
amazonCloud = mkForeign (FFun "require('aws-sdk');" [] FPtr) >>= return . AWS | |
s3Service : Cloud -> IO Service | |
s3Service (AWS p) = | |
mkForeign (FFun "new %0.S3();" [FPtr] FPtr) p >>= return . S3 | |
------------------------^ breaks "__var_0 is not defined" | |
-- Having problems with Idris 'node' codegen on master from github. | |
-- The examples given in code in idris-dev (lib/javascript) and also | |
-- in tutorial pdf (%0 & %1 variable substitution) don't seem to work | |
-- on the latest idris. The above the variable __var_0 is undefined in | |
-- the generated javascript. | |
s3ListBuckets : Service -> IO () | |
s3ListBuckets (S3 p) = | |
mkForeign (FFun "%0.listBuckets({}, function(_e,_d) {});" [FPtr] FUnit) p | |
-- Same problem happens here ^ | |
main : IO () | |
main = amazonCloud >>= s3Service >>= s3ListBuckets |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment