This file contains 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.Fin | |
%default total | |
%access public export | |
||| Numbers strictly less than some bound. The name comes from "finite sets". | |
||| | |
||| It's probably not a good idea to use `Fin` for arithmetic, and they will be | |
||| exceedingly inefficient at run time. | |
||| @ n the upper bound |
This file contains 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
resolver: ghc-8.0.0.20160111 | |
setup-info: | |
ghc: | |
linux64: | |
8.0.0.20160111: | |
url: "http://downloads.haskell.org/~ghc/8.0.1-rc1/ghc-8.0.0.20160111-x86_64-deb7-linux.tar.xz" | |
content-length: 111404852 | |
sha1: 30d39c6ca6994dcafe25595e053035ad23198b52 | |
macosx: | |
8.0.0.20160111: |
This file contains 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 DataKinds #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
module Main where | |
import Data.Proxy | |
import Data.Type.Equality |
This file contains 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 LambdaCase #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
import Control.Concurrent (forkIO, newEmptyMVar, putMVar, takeMVar) | |
import Control.Exception (finally) | |
import Control.Monad | |
import Control.Monad.Trans (liftIO) | |
import Data.ByteString.Char8 () | |
import qualified Data.ByteString as B | |
import Data.Monoid |
This file contains 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
/* | |
* Licensed to the Apache Software Foundation (ASF) under one or more | |
* contributor license agreements. See the NOTICE file distributed with | |
* this work for additional information regarding copyright ownership. | |
* The ASF licenses this file to You under the Apache License, Version 2.0 | |
* (the "License"); you may not use this file except in compliance with | |
* the License. You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* |
This file contains 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
foo :: Int -> Int | |
foo x | x > 0 = x -1 | |
foo x | otherwise = 0 |
This file contains 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 FlexibleContexts #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE TypeOperators #-} | |
import GHC.Generics | |
import Data.Foldable as Foldable | |
import Data.Monoid |
This file contains 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 RankNTypes #-} | |
import qualified GHC.Event | |
data TimerManager2 = TimerManager2 | |
{ registerTimeout :: Int -> GHC.Event.TimeoutCallback -> IO GHC.Event.TimeoutKey | |
, updateTimeout :: GHC.Event.TimeoutKey -> Int -> IO () | |
, unregisterTimeout :: GHC.Event.TimeoutKey -> IO () | |
} |
This file contains 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 | |
set -e | |
cat > /etc/yum.repos.d/upgrade.repo <<END | |
[upgrade] | |
name=upgrade | |
baseurl=http://dev.centos.org/centos/6/upg/x86_64/ | |
enabled=1 | |
gpgcheck=0 | |
END |
This file contains 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
connectionUrl :: Monad m => ReaderT m Config B.ByteString | |
-- withConnection | |
-- :: (Database.PostgreSQL.Simple.Internal.Connection -> IO c) | |
-- -> ReaderT Config IO c | |
withConnection f = do | |
url <- connectionUrl | |
liftIO $ bracket (connectPostgreSQL url) close f |