udpate purescript package set

This commit is contained in:
Jon Schoning 2019-11-13 22:03:21 -06:00
parent b0664136e3
commit f8be202f15
7 changed files with 25 additions and 26 deletions

View file

@ -1,8 +1,8 @@
let mkPackage = let mkPackage =
https://raw.githubusercontent.com/purescript/package-sets/psc-0.13.3-20190818/src/mkPackage.dhall sha256:0b197efa1d397ace6eb46b243ff2d73a3da5638d8d0ac8473e8e4a8fc528cf57 https://raw.githubusercontent.com/purescript/package-sets/psc-0.13.4-20191110/src/mkPackage.dhall sha256:0b197efa1d397ace6eb46b243ff2d73a3da5638d8d0ac8473e8e4a8fc528cf57
let upstream = let upstream =
https://raw.githubusercontent.com/purescript/package-sets/psc-0.13.3-20190818/src/packages.dhall sha256:c95c4a8b8033a48a350106b759179f68a695c7ea2208228c522866fd43814dc8 https://raw.githubusercontent.com/purescript/package-sets/psc-0.13.4-20191110/src/packages.dhall sha256:563a7f694e18e6399f7f6d01f5b7e3c3345781655d99945768f48e458feb93a4
let overrides = {=} let overrides = {=}

View file

@ -2,7 +2,7 @@ module App where
import Prelude import Prelude
import Affjax (Response, ResponseFormatError) import Affjax (Response, Error)
import Affjax (defaultRequest) as AX import Affjax (defaultRequest) as AX
import Affjax as Ax import Affjax as Ax
import Affjax.RequestBody as AXReq import Affjax.RequestBody as AXReq
@ -34,28 +34,28 @@ toggleStar bid action = do
let path = "bm/" <> show bid <> "/" <> show action let path = "bm/" <> show bid <> "/" <> show action
void (fetchUrlEnc POST path Nothing AXRes.ignore) void (fetchUrlEnc POST path Nothing AXRes.ignore)
destroy :: Int -> Aff (Response (Either ResponseFormatError Unit)) destroy :: Int -> Aff (Either Error (Response Unit))
destroy bid = destroy bid =
fetchUrlEnc DELETE ("bm/" <> show bid) Nothing AXRes.ignore fetchUrlEnc DELETE ("bm/" <> show bid) Nothing AXRes.ignore
markRead :: Int -> Aff (Response (Either ResponseFormatError Unit)) markRead :: Int -> Aff (Either Error (Response Unit))
markRead bid = do markRead bid = do
let path = "bm/" <> show bid <> "/read" let path = "bm/" <> show bid <> "/read"
fetchUrlEnc POST path Nothing AXRes.ignore fetchUrlEnc POST path Nothing AXRes.ignore
editBookmark :: Bookmark -> Aff (Response (Either ResponseFormatError Unit)) editBookmark :: Bookmark -> Aff (Either Error (Response Unit))
editBookmark bm = do editBookmark bm = do
fetchJson POST "api/add" (Just (Bookmark' bm)) AXRes.ignore fetchJson POST "api/add" (Just (Bookmark' bm)) AXRes.ignore
editNote :: Note -> Aff (Response (Either ResponseFormatError Json)) editNote :: Note -> Aff (Either Error (Response Json))
editNote bm = do editNote bm = do
fetchJson POST "api/note/add" (Just (Note' bm)) AXRes.json fetchJson POST "api/note/add" (Just (Note' bm)) AXRes.json
destroyNote :: Int -> Aff (Response (Either ResponseFormatError Unit)) destroyNote :: Int -> Aff (Either Error (Response Unit))
destroyNote nid = do destroyNote nid = do
fetchUrlEnc DELETE ("api/note/" <> show nid) Nothing AXRes.ignore fetchUrlEnc DELETE ("api/note/" <> show nid) Nothing AXRes.ignore
editAccountSettings :: AccountSettings -> Aff (Response (Either ResponseFormatError Unit)) editAccountSettings :: AccountSettings -> Aff (Either Error (Response Unit))
editAccountSettings us = do editAccountSettings us = do
fetchJson POST "api/accountSettings" (Just (AccountSettings' us)) AXRes.ignore fetchJson POST "api/accountSettings" (Just (AccountSettings' us)) AXRes.ignore
@ -73,7 +73,7 @@ fetchJson
-> String -> String
-> Maybe b -> Maybe b
-> AXRes.ResponseFormat a -> AXRes.ResponseFormat a
-> Aff (Response (Either ResponseFormatError a)) -> Aff (Either Error (Response a))
fetchJson method path content rt = fetchJson method path content rt =
fetchPath method path [ContentType applicationJSON] (AXReq.string <<< J.writeJSON <$> content) rt fetchPath method path [ContentType applicationJSON] (AXReq.string <<< J.writeJSON <$> content) rt
@ -83,7 +83,7 @@ fetchUrlEnc
-> String -> String
-> Maybe FormURLEncoded -> Maybe FormURLEncoded
-> AXRes.ResponseFormat a -> AXRes.ResponseFormat a
-> Aff (Response (Either ResponseFormatError a)) -> Aff (Either Error (Response a))
fetchUrlEnc method path content rt = fetchUrlEnc method path content rt =
fetchPath method path [ContentType applicationFormURLEncoded] (AXReq.FormURLEncoded <$> content) rt fetchPath method path [ContentType applicationFormURLEncoded] (AXReq.FormURLEncoded <$> content) rt
@ -94,7 +94,7 @@ fetchPath
-> Array RequestHeader -> Array RequestHeader
-> Maybe AXReq.RequestBody -> Maybe AXReq.RequestBody
-> AXRes.ResponseFormat a -> AXRes.ResponseFormat a
-> Aff (Response (Either ResponseFormatError a)) -> Aff (Either Error (Response a))
fetchPath method path headers content rt = fetchPath method path headers content rt =
fetchUrl method ((app' unit).homeR <> path) headers content rt fetchUrl method ((app' unit).homeR <> path) headers content rt
@ -105,7 +105,7 @@ fetchUrl
-> Array RequestHeader -> Array RequestHeader
-> Maybe AXReq.RequestBody -> Maybe AXReq.RequestBody
-> AXRes.ResponseFormat a -> AXRes.ResponseFormat a
-> Aff (Response (Either ResponseFormatError a)) -> Aff (Either Error (Response a))
fetchUrl method url headers content rt = fetchUrl method url headers content rt =
Ax.request Ax.request
AX.defaultRequest AX.defaultRequest

View file

@ -5,7 +5,7 @@ import Prelude hiding (div)
import App (destroyNote, editNote) import App (destroyNote, editNote)
import Component.Markdown as Markdown import Component.Markdown as Markdown
import Data.Array (drop, foldMap) import Data.Array (drop, foldMap)
import Data.Either (Either(..)) import Data.Foldable (for_)
import Data.Lens (Lens', lens, use, (%=), (.=)) import Data.Lens (Lens', lens, use, (%=), (.=))
import Data.Maybe (Maybe(..), maybe) import Data.Maybe (Maybe(..), maybe)
import Data.Monoid (guard) import Data.Monoid (guard)
@ -200,13 +200,12 @@ nnote st' =
handleAction (NEditSubmit e) = do handleAction (NEditSubmit e) = do
H.liftEffect (preventDefault e) H.liftEffect (preventDefault e)
edit_note <- use _edit_note edit_note <- use _edit_note
res <- H.liftAff (editNote edit_note) res' <- H.liftAff (editNote edit_note)
case res.body of for_ res' \res -> do
Left err -> pure unit let r = res.body
Right r -> do if (edit_note.id == 0)
if (edit_note.id == 0) then do
then do liftEffect (setHref (fromNullableStr app.noteR) =<< _loc)
liftEffect (setHref (fromNullableStr app.noteR) =<< _loc) else do
else do _note .= edit_note
_note .= edit_note _edit .= false
_edit .= false

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.