Skip to content

Instantly share code, notes, and snippets.

@mdmarek
mdmarek / WaiApp3.hs
Created May 13, 2012 22:06
Haskell web application to serve static files.
{-# LANGUAGE OverloadedStrings #-}
-- | Wai+Warp file server. Used GHC 7.4, Wai 1.1, Warp 1.1 versions.
module Main where
import Network.Wai.Handler.Warp (run)
import Network.Wai.Application.Static
( StaticSettings(..)
, staticApp
, fileSystemLookup
@mdmarek
mdmarek / TextMatrix.hs
Created May 12, 2012 01:42
Read matrix from CSV file and convert to Matrix (Hmatrix)
{-# LANGUAGE OverloadedStrings #-}
-- | Converts a matrix represented as text to Hmatrix Matrix. Used GHC 7.4, Hmatrix 0.14.
module Main where
import qualified Data.Text as T
import qualified Data.Text.IO as TIO
import Data.Text (Text,splitOn,lines)
import Data.Text.Read (double)
import Data.Packed.Matrix (Matrix,fromLists)
@mdmarek
mdmarek / WaiApp1.hs
Created May 6, 2012 17:12
Minimum Wai + Warp Application Server. Compiled with GHC 7.4, Wai 1.1, Warp 1.1 versions.
{-# LANGUAGE OverloadedStrings #-}
-- | Hello world Wai+Warp applicaion server. Used GHC 7.4, Wai 1.1, Warp 1.1 versions.
module Main where
import Network.HTTP.Types (status200)
import Network.Wai (Application,responseLBS)
import Network.Wai.Handler.Warp (run)
-- | Hello word Wai application.