Skip to content

Instantly share code, notes, and snippets.

h x=maximum$0:[y|(l,y,r)<-b,l<=x,x<r]
print[(x,h x)|x<-[1..9999],h x/=h(x-1)]
-- | Converts a 'ClockTime' into an HTTP timestamp.
formatHttpTime :: UTCTime -> ByteString
formatHttpTime = fromStr . formatTime defaultTimeLocale "%a, %d %b %Y %X GMT"
-- | Converts an HTTP timestamp into a 'UTCTime'.
parseHttpTime :: ByteString -> Maybe UTCTime
parseHttpTime s' =
parseTime defaultTimeLocale "%a, %d %b %Y %H:%M:%S GMT" s
where
s = toStr s'
------------------------------------------------------------------------------
-- HTTP dates
-- | Converts a 'CTime' into an HTTP timestamp.
formatHttpTime :: CTime -> IO ByteString
-- | Converts an HTTP timestamp into a 'CTime'.
parseHttpTime :: ByteString -> IO CTime
#ifdef WIN32
Resolving dependencies...
Configuring snap-server-0.2.4...
Warning: 'hs-source-dirs: dist/build/autogen' directory does not exist.
Preprocessing library snap-server-0.2.4...
Building snap-server-0.2.4...
[1 of 8] Compiling Snap.Internal.Http.Parser ( src\Snap\Internal\Http\Parser.hs, dist\build\Snap\Int
ernal\Http\Parser.o )
src\Snap\Internal\Http\Parser.hs:114:4:
Couldn't match expected type `Iteratee IO a'
diff --git a/src/Text/Templating/Heist/Internal.hs b/src/Text/Templating/Heist/Internal.hs
index 0a65b28..1ea4169 100644
--- a/src/Text/Templating/Heist/Internal.hs
+++ b/src/Text/Templating/Heist/Internal.hs
@@ -19,6 +19,7 @@ import Data.Map (Map)
import Data.Typeable
import Prelude hiding (catch)
import System.Directory.Tree hiding (name)
+import System.FilePath.Posix
import Text.XML.Expat.Format
site :: MVar SimState -> Snap ()
site sim = catch500 $
ifTop (fileServe "static/index.html")
<|> route [ ("vessel/speed/:speed", method PUT putSpeed sim)
, ("vessel", method GET getSim sim)
]
<|> fileServe "static"
On Ubuntu 10.04:
> runghc HDBC-Ubuntu.hs
HDBC-Ubuntu.hs: Prelude.(!!): index too large
On Windows XP:
> runghc HDBC-Windows.hs
HDBC-Windows.hs: Prelude.(!!): index too large
problem.hs:4:4:
Inferred type is less polymorphic than expected
Quantified type variable `a' is mentioned in the environment:
out :: Enumerator Builder IO a (bound at problem.hs:3:4)
In the first argument of `addToOutput', namely `out'
In the expression: addToOutput out
In the expression:
do { out <- runRequestBody mkOutput;
addToOutput out }
mapBind' :: (Monad m) => (a -> [(Text, Splice m)]) -> [a] -> Splice m
mapBind' f = liftM concat . mapM localSplices
where
localSplices v = localTS
(bindSplices $ f v)
(runNodeList =<< liftM X.childNodes getParamNode)
withPost :: Splice Application
withPost = callView [ ("title", titleSplice)
, ("date", dateSplice)
, ("body", bodySplice) ]
withPost :: Splice Application
withPost = viewWith [ ("title", titleSplice)
, ("date", dateSplice)
, ("body", bodySplice) ]