Init noodle

This commit is contained in:
Konrad Merz 2015-03-28 08:47:36 +01:00
commit 7da5e1005d
6 changed files with 86 additions and 0 deletions

1
.noodle.db.txt Normal file
View file

@ -0,0 +1 @@
fromList [(2,Poll {name = "Was wollen wir trinken?", opts = fromList [(1,Opt {desc = "Bier", up = [], down = []}),(2,Opt {desc = "Wein", up = [], down = []}),(3,Opt {desc = "Wasser", up = [], down = []}),(4,Opt {desc = "Kaffee", up = [], down = []}),(5,Opt {desc = "Saft", up = [], down = []})]})]

26
LICENSE Normal file
View file

@ -0,0 +1,26 @@
Copyright (c) 2015, Konrad Merz
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the
distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

2
Setup.hs Normal file
View file

@ -0,0 +1,2 @@
import Distribution.Simple
main = defaultMain

25
noodle.cabal Normal file
View file

@ -0,0 +1,25 @@
-- Initial noodle.cabal generated by cabal init. For further
-- documentation, see http://haskell.org/cabal/users-guide/
name: noodle
version: 0.1.0.0
synopsis: Noodle - The real doole
-- description:
homepage: https://github.com/kmerz/noodle
license: BSD2
license-file: LICENSE
author: Konrad Merz
maintainer: kmerz@hulud.net
-- copyright:
category: Web
build-type: Simple
-- extra-source-files:
cabal-version: >=1.10
executable noodle
main-is: main.hs
other-modules: Noodle.Views.Index
-- other-extensions:
build-depends: base >=4.7 && <4.8, scotty, blaze-html, monads-tf
hs-source-dirs: src
default-language: Haskell2010

15
src/Noodle/Views/Index.hs Normal file
View file

@ -0,0 +1,15 @@
{-# LANGUAGE OverloadedStrings #-}
module Noodle.Views.Index where
import qualified Text.Blaze.Html5 as H
import qualified Text.Blaze.Html5.Attributes as A
import Text.Blaze.Html.Renderer.Text
render items = do
H.html $ do
H.body $ do
H.h1 "My todo list"
H.ul $ do
H.li (head items)
H.li (head items)

17
src/main.hs Normal file
View file

@ -0,0 +1,17 @@
{-# LANGUAGE OverloadedStrings #-}
import Control.Monad.Trans (liftIO)
import qualified Web.Scotty as S
import qualified Text.Blaze.Html5 as H
import qualified Text.Blaze.Html5.Attributes as A
import Text.Blaze.Html.Renderer.Text
import Database.HDBC
import Database.HDBC.Sqlite3
import qualified Noodle.Views.Index
blaze = S.html . renderHtml
main = S.scotty 3000 $ do
S.get "/" $ do
blaze $ Noodle.Views.Index.render [ "Konrad" ]