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 | |
# Setup new ppas | |
sudo apt-get update | |
sudo apt-get install -y software-properties-common python-software-properties | |
sudo add-apt-repository -y ppa:hvr/ghc | |
sudo add-apt-repository -y ppa:pi-rho/dev | |
sudo apt-add-repository -y ppa:chris-lea/node.js | |
# Make the system not suck |
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 Data.Time.DayOfWeek where | |
import Data.Time | |
import Data.Time.Calendar.WeekDate | |
data DayOfWeek = Sunday | |
| Monday | |
| Tuesday | |
| Wednesday | |
| Thursday |
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 Login.Action ( | |
loginUser | |
, logoutUser | |
, registerUser | |
) where | |
import Grocery.Types.User | |
import Types | |
import Login.StateMachine | |
import Network.Http.StatusHelpers |
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 Grocery.Calendar where | |
import Data.Time | |
import Grocery.Types.Meal | |
import Control.Lens | |
import Data.Ord | |
import Data.List (sortBy) | |
type Calendar = [(Day, [Meal])] |
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 MealPlan where | |
import Network.Http.StatusHelpers | |
import qualified Grocery.Types as GT | |
import Grocery.ListHelpers | |
import Utils.Actions | |
import Types | |
import qualified Login.StateMachine as Login |
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
def min_by(ary, &fn) | |
first, *rest = ary; | |
min_elem, _ = rest.reduce([first, fn.call(first)]) do |(min_elem, min), new_elem| | |
if (new_min = fn.call(new_elem)) < min | |
[ new_elem, new_min ] | |
else | |
[ min_elem, min ] | |
end | |
end | |
min_elem |
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 Data.List.HelpersTest where | |
import Test.Tasty | |
import Test.Tasty.SmallCheck as SC | |
import Test.Tasty.QuickCheck as QC | |
import Test.Tasty.HUnit | |
import Data.List (nub) | |
import Data.List.Helpers |
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 OverloadedStrings #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
module Login where | |
import DatabaseSupport | |
import qualified Database.Persist as DB | |
import qualified Database.Persist.Sqlite as DB | |
import Grocery.Types | |
import Grocery.Database |
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 TypeFamilies #-} | |
{-# LANGUAGE QuasiQuotes #-} | |
{-# LANGUAGE TemplateHaskell #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
{-# LANGUAGE DeriveGeneric #-} | |
module Grocery.Database where |
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 Login where | |
import qualified Data.Text as T | |
type LoginMessage = T.Text | |
data LoginState = | |
-- This user is logged in | |
LoggedIn User |