-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor Page, documentation, Dockerfile
- Loading branch information
Showing
30 changed files
with
264 additions
and
144 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.git | ||
.stack-work | ||
client/node_modules | ||
Dockerfile | ||
dist-newstyle |
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,46 @@ | ||
FROM haskell:9.8.2 AS base | ||
WORKDIR /opt/build | ||
|
||
RUN cabal update | ||
# skeletest network | ||
RUN cabal install bytestring containers casing effectful text wai warp wai-websockets cookie string-conversions hpack | ||
|
||
|
||
FROM haskell:9.8.2 AS dependencies | ||
WORKDIR /opt/build | ||
COPY --from=base /root/.cache /root/.cache | ||
COPY --from=base /root/.local /root/.local | ||
COPY --from=base /root/.config /root/.config | ||
|
||
# RUN apt-get update && apt-get install -y libpcre3 libpcre3-dev libcurl4-openssl-dev cron vim rsyslog | ||
ADD ./package.yaml . | ||
ADD ./cabal.project . | ||
RUN hpack | ||
RUN cabal build --only-dependencies | ||
|
||
FROM haskell:9.8.2 AS build | ||
WORKDIR /opt/build | ||
COPY --from=dependencies /root/.cache /root/.cache | ||
COPY --from=dependencies /root/.local /root/.local | ||
COPY --from=dependencies /root/.config /root/.config | ||
ADD ./package.yaml . | ||
ADD ./cabal.project . | ||
ADD ./client ./client | ||
ADD ./test ./test | ||
ADD ./src ./src | ||
ADD ./example ./example | ||
ADD *.md . | ||
ADD LICENSE . | ||
RUN hpack | ||
RUN cd example && hpack && cabal build examples | ||
RUN mkdir bin | ||
RUN cd example && export EXEC=$(cabal list-bin examples); cp $EXEC /opt/build/bin/examples | ||
|
||
|
||
FROM debian:10 AS app | ||
WORKDIR /opt/app | ||
|
||
COPY --from=build /opt/build/bin/examples ./examples | ||
|
||
# ENV DYNAMO_LOCAL=False | ||
ENTRYPOINT ["/opt/app/examples"] |
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,2 @@ | ||
dist-newstyle | ||
.git |
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
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
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
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
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
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
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
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
packages: | ||
. | ||
../ | ||
../../web-view/ | ||
-- ../../web-view/ |
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 |
---|---|---|
@@ -1,22 +1,45 @@ | ||
{-# LANGUAGE UndecidableInstances #-} | ||
|
||
module Intro where | ||
|
||
import Data.Text (Text) | ||
import Web.Hyperbole | ||
|
||
|
||
main :: IO () | ||
main = do | ||
run 3000 $ do | ||
liveApp (basicDocument "Example") (runPage messagePage) | ||
|
||
|
||
messagePage :: Page es '[] | ||
messagePage :: Eff es (Page '[]) | ||
messagePage = do | ||
pure $ do | ||
el bold "Hello World" | ||
|
||
|
||
messageView :: Text -> View c () | ||
messageView :: Text -> View Message () | ||
messageView m = do | ||
el_ "Message:" | ||
el_ (text m) | ||
el bold $ text $ "Message: " <> m | ||
button (SetMessage "Goodbye") (border 1) "Say Goodbye" | ||
|
||
|
||
data Message = Message | ||
deriving (Show, Read, ViewId) | ||
|
||
|
||
instance HyperView Message es where | ||
data Action Message | ||
= SetMessage Text | ||
deriving (Show, Read, ViewAction) | ||
|
||
|
||
update (SetMessage t) = | ||
pure $ el_ (text t) | ||
|
||
|
||
messagePage' :: Eff es (Page '[Message]) | ||
messagePage' = do | ||
pure $ do | ||
hyper Message $ do | ||
el bold "Hello World" | ||
button (SetMessage "Goodbye") (border 1) "Say Goodbye" |
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,32 @@ | ||
{-# LANGUAGE UndecidableInstances #-} | ||
|
||
module Intro2 where | ||
|
||
import Data.Text (Text) | ||
import Web.Hyperbole | ||
|
||
|
||
messageView :: Text -> View Message () | ||
messageView m = do | ||
el bold $ text $ "Message: " <> m | ||
button (SetMessage "Goodbye") (border 1) "Say Goodbye" | ||
|
||
|
||
messagePage :: Eff es (Page '[Message]) | ||
messagePage = do | ||
pure $ do | ||
hyper Message $ messageView "Hello" | ||
|
||
|
||
data Message = Message | ||
deriving (Show, Read, ViewId) | ||
|
||
|
||
instance HyperView Message es where | ||
data Action Message | ||
= SetMessage Text | ||
deriving (Show, Read, ViewAction) | ||
|
||
|
||
update (SetMessage t) = | ||
pure $ messageView t |
Oops, something went wrong.