Created
March 24, 2015 15:27
-
-
Save TrevorBasinger/dd89a00c2c8dddb5f0de to your computer and use it in GitHub Desktop.
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 where | |
| import Debug.Trace | |
| import Control.Monad.Aff | |
| import Control.Monad.Eff | |
| import Control.Monad.Eff.Class (liftEff) | |
| import Control.Monad.Eff.Exception (message) | |
| import Control.Monad.Cont.Trans | |
| import Control.Monad.Reader.Class | |
| import Control.Monad.Reader.Trans | |
| import Data.Array | |
| import Data.Evernote | |
| import Data.Evernote.Client | |
| import Data.Evernote.Notebook | |
| import Data.Evernote.NoteStore | |
| import Data.Either | |
| import Data.Foldable | |
| import Data.Maybe | |
| import Data.Foreign | |
| import Data.Foreign.Class | |
| foreign import data Log :: ! | |
| foreign import log | |
| """ | |
| function log (a) { | |
| console.log (a); | |
| return {}; | |
| } | |
| """ :: forall a eff. a -> Eff (log :: Log | eff) Unit | |
| type ENApp e a = ReaderT Token (Aff e) a | |
| token = Token "S=s1:U=9017f:E=151d5578947:C=14a7da65b30:P=1cd:A=en-devtoken:V=2:H=4da3bded8054798923949c2d054592c4" | |
| nsUrl = NoteStoreUrl "https://sandbox.evernote.com/shard/s1/notestore" | |
| fetchNotebooks:: forall e. Token -> Aff e String | |
| fetchNotebooks t = getNotebooks $ makeNoteStore (makeClient t) nsUrl | |
| showErrMsg = trace <<< message | |
| test :: forall e. Aff (trace :: Trace | e) String | |
| test = do result <- fetchNotebooks token | |
| liftEff $ trace result | |
| return "Done!" | |
| main :: forall e. EffA (trace :: Trace) Unit | |
| main = do | |
| launchAff test | |
| return unit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment