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
| #!/bin/bash | |
| set -euxo pipefail | |
| get_project_versions() | |
| { | |
| find . -path ./.stack-work -prune -o -iname '*.cabal' -exec awk '/^version:/ {print $2}' {} \+ | |
| } | |
| get_project_names() | |
| { |
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
| getUsersR' :: Handler [User] | |
| getUsersR' = | |
| return | |
| [ User 1 "Isaac" "Newton" | |
| , User 2 "Albert" "Einstein" | |
| ] | |
| getUsersR :: Handler Value | |
| getUsersR = toJSON <$> getUsersR' |
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
| {-# LANGUAGE UndecidableInstances #-} | |
| instance {-# OVERLAPPABLE #-} (ToJSON a) => ToContent a where | |
| toContent = toContent . toJSON | |
| instance {-# OVERLAPPABLE #-} (ToJSON a) => ToTypedContent a where | |
| toTypedContent = TypedContent typeJson . toContent | |
| getUsersR :: Handler [User] | |
| getUsersR = | |
| return |
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
| -- Imagine we started with just this route | |
| getUsersR :: Handler Value | |
| getUsersR = | |
| returnJson | |
| [ User 1 "Isaac" "Newton" | |
| , User 2 "Albert" "Einstein" | |
| ] | |
| -- If we later try to add the following route without changing the above, |
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
| users :: Handler [User] | |
| users = | |
| return | |
| [ User 1 "Isaac" "Newton" | |
| , User 2 "Albert" "Einstein" | |
| ] | |
| firstUser :: Handler User | |
| firstUser = head <$> users |
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
| #!/bin/bash | |
| # bin/compile <build-dir> <cache-dir> <env-dir> | |
| # Heroku-provided params | |
| BUILD_DIR="$1" | |
| CACHE_DIR="$2" | |
| ENV_DIR="$3" | |
| # Default configuration which you can change by setting environment variables | |
| # e.g. heroku config:set CLEAR_BUILDPACK_CACHE=1 |