diff options
author | Nick <nicksima@gmail.com> | 2019-01-25 10:30:03 -0800 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2019-01-28 12:07:42 -0800 |
commit | 5a9ca5c89aa32331450609e13aab1cfb56d9020b (patch) | |
tree | b5fa60719c96c01c132e2f708b58c8059fe458d0 /ibb | |
parent | fda568da816f38d318fb9b0d7f8798eb36c792c3 (diff) |
Implement a basic mock-up of IBB
Diffstat (limited to 'ibb')
-rw-r--r-- | ibb/Main.hs | 70 | ||||
-rw-r--r-- | ibb/default.nix | 42 | ||||
-rw-r--r-- | ibb/ibb.cabal | 25 | ||||
-rw-r--r-- | ibb/shell.nix | 5 |
4 files changed, 115 insertions, 27 deletions
diff --git a/ibb/Main.hs b/ibb/Main.hs index e552769..48e93b1 100644 --- a/ibb/Main.hs +++ b/ibb/Main.hs @@ -1,4 +1,72 @@ +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE QuasiQuotes #-} + module Main where +import Web.Scotty (ActionM, scotty, get, html) +import Text.Blaze.Html.Renderer.Text (renderHtml) +import Text.Hamlet (shamlet) +import Text.Blaze.Html (Html) +import Text.Blaze (Markup) +import Data.Monoid (mconcat) + +render :: Html -> ActionM () +render = html . renderHtml + main :: IO () -main = putStrLn "Hello World" +main = scotty 3000 $ + get "/" $ render steveJobs + +steveJobs :: Markup +steveJobs = [shamlet| +<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous"> +<nav .navbar .navbar-light .bg-light> + <h3 .navbar-brand>IBB + <button .navbar-toggler type="button" data-toggle="collapse" data-target="#navbarTogglerDemo02" aria-controls="navbarTogglerDemo02" aria-expanded="false" aria-label="Toggle navigation"> + <span .navbar-toggler-icon> + <div .collapse .navbar-collapse id="navbarIbb"> + <ul .navbar-nav .mr-auto .mt-2 .mt-lg-0> + <li .nav-item .active> + <p .nav-item>One +<div .container> + <div .row> + <div .card .ml-3 .mb-3 style=width:22rem;> + <img .card-img .img-fluid src="https://pbs.twimg.com/profile_images/552307347851210752/vrXDcTFC_400x400.jpeg"> + <h4>Joe Rogan + <ul> + <li><a href="https://www.amazon.com/Food-Gods-Original-Knowledge-Evolution/dp/0553371304/ref=as_li_ss_tl?s=books&ie=UTF8&qid=1510184452&sr=1-1&keywords=food+of+the+gods&linkCode=sl1&tag=jrebooks-20&linkId=2985689be53efde5cc377fe9c74de7a0">Food of the Gods</a> + <li><a href="https://www.amazon.com/War-Art-Through-Creative-Battles/dp/1936891026/ref=as_li_ss_tl?s=books&ie=UTF8&qid=1509600244&sr=1-1&keywords=the+war+of+art+steven+pressfield&dpID=41hM%252BLf2pLL&preST=_SY291_BO1,204,203,200_QL40_&dpSrc=srch&linkCode=sl1&tag=jrebooks-20&linkId=5fa2e21ba505d6b23d71e2f0d074e435">The War of Art</a> + <div .card-footer> + <a .btn href="https://www.joerogan.com"> Personal Website + <div .card .ml-3 .mb-3 style=width:22rem;> + <img .card-img .img-fluid src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTxT84sF19lxdnSiblIXAp-Y4wAigpQn8sZ2GtAerIR_ApiiEJfFQ"> + <h4>Beyoncé + <ul> + <li><a href="https://www.amazon.com/dp/B00E257Y7G/ref=dp-kindle-redirect?_encoding=UTF8&btkr=1">What Will It Take To Make A Women President?</a> + <div .card-footer> + <a .btn href="https://www.beyonce.com"> Personal Website + <div .card .ml-3 .mb-3 style=width:22rem;> + <img .card-img .img-fluid src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQeLzftR36p0hYI-EKNa5fm7CYDuN-vyz23_R48ocqa8X1nPr6C"> + <h4>Barrack Obama + <ul> + <li><a href="https://www.amazon.com/American-Marriage-Novel-Oprahs-Selection-ebook/dp/B01NCUXEFR">An American Marriage</a> + <li><a href="https://www.amazon.com/dp/B00A9ET4MC/ref=dp-kindle-redirect?_encoding=UTF8&btkr=1">Americanah</a> + <div .card-footer> + <a .btn href="https://barackobama.com"> Personal Website + <div .card .ml-3 .mb-3 style=width:22rem;> + <img .card-img .img-fluid src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQQbmnUykS6zqgzaf44tsq1RAsnHe6H7fapEoSqUwAoJGSFKbAPSw"> + <h4>Warren Buffett + <ul> + <li><a href="https://www.amazon.com/dp/B000FC12C8/ref=dp-kindle-redirect?_encoding=UTF8&btkr=1">The Intelligent Investor</a> + <li><a href="https://www.amazon.com/Security-Analysis-Foreword-Buffett-Editions-ebook/dp/B0037JO5J8">Security Analysis</a> + <div .card-footer> + <a .btn href="http://www.berkshirehathaway.com"> Personal Website + <div .card .ml-3 .mb-3 style=width:22rem;> + <img .card-img .img-fluid src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQfl_Dm2RUhknIxGEafGOlQC7Jj3Ky0nyQYk6GvG791sClzwFQb"> + <h4>Micheal Jordan + <ul> + <li><a href="https://www.amazon.com/Statistical-Inference-George-Casella/dp/0534243126">Statistical Inference</a> + <li><a href="https://www.amazon.com/Course-Sample-Chapman-Statistical-Science/dp/0412043718">A Course in Large Sample Theory</a> + <div .card-footer> + <a .btn href="http://www.michaeljordansworld.com"> Fanmade Website +|] diff --git a/ibb/default.nix b/ibb/default.nix index 4384001..1d6a065 100644 --- a/ibb/default.nix +++ b/ibb/default.nix @@ -1,23 +1,23 @@ -{ stdenv -, mkDerivation -, base +{ compiler ? "ghc843" +, doHaddock ? false +, doBenchmark ? false +, doCheck ? true +, withHoogle ? false +, pkgs ? import (fetchGit (import ../pkgs.nix)) {} }: -mkDerivation { - pname = "ibb"; - version = "0"; - src = ./.; - isExecutable = true; - libraryHaskellDepends = [ - base - ]; - executableHaskellDepends = [ - base - ]; - testHaskellDepends = [ - base - ]; - homepage = "https://git.sr.ht/~ben/biz"; - description = "biz"; - license = stdenv.lib.licenses.bsd3; -} +with pkgs; + +haskell.packages.${compiler}.developPackage { + root = ./.; + overrides = with haskell.lib; self: super: { + ghc = + if withHoogle + then super.ghc // {withPackages = super.ghc.withHoogle;} + else super.ghc; + ghcWithPackages = + if withHoogle + then self.ghc.withPackages + else super.ghcWithPackages; + }; +}
\ No newline at end of file diff --git a/ibb/ibb.cabal b/ibb/ibb.cabal new file mode 100644 index 0000000..2543ebb --- /dev/null +++ b/ibb/ibb.cabal @@ -0,0 +1,25 @@ +name: ibb +version: 2 +category: Text +homepage: https://bsima.me +author: Nick Sima +maintainer: nicksima@gmail.com +copyright: 2018 Nick Sima +license: BSD3 +license-file: LICENSE +build-type: Simple +cabal-version: >= 1.10 + +executable ibb + main-is: Main.hs + other-modules: + Paths_web + hs-source-dirs: . + default-extensions: OverloadedStrings + ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N + build-depends: + base >= 4.6 && < 5 + , scotty + , shakespeare + , blaze + default-language: Haskell2010
\ No newline at end of file diff --git a/ibb/shell.nix b/ibb/shell.nix deleted file mode 100644 index b29c3ae..0000000 --- a/ibb/shell.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ nixpkgs ? import (fetchGit (import ../pkgs.nix)) {} -, compiler ? "ghc862" -}: -let ibb = nixpkgs.pkgs.haskell.packages.${compiler}.callPackage ./default.nix {}; -in ibb.env |