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
-- This code will run into an infinite loop when the strict state | |
-- monad is used while it terminates just fine for the lazy state | |
-- monad. In particular monadic binds in the strict state monad cannot | |
-- depend on values defined later while this is possible in the lazy | |
-- state monad. | |
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
{-# LANGUAGE RecursiveDo #-} | |
{-# LANGUAGE BangPatterns #-} | |
module Main where | |
import Control.Monad.Fix |
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
-- This gist provides an explanation for why Haskell is significantly | |
-- faster than ATS and Rust in [vmchale’s great | |
-- benchmarks](https://github.com/vmchale/ats-benchmarks). What’s | |
-- happening is that the `derangements` list gets memoized so the | |
-- benchmark only checks the performance of (!!). `derangements'` | |
-- prevents GHC from memoizing the list and results in a significant | |
-- loss of performance. Criterion does try to prevent memoization but | |
-- it only prevents memoization of the function application (that’s | |
-- why the function and the argument need to be passed separately to | |
-- `nf`). It cannot prevent the memoization of the `derangements` |
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
Inductive ev_dumb : nat -> Prop := | |
| EvDBase : ev_dumb 0 | |
| EvDRec : forall n, ev_dumb n /\ n <> 1 -> ev_dumb (S (S n)). | |
Lemma ev_dumb_ind' : | |
forall P : nat -> Prop, | |
P 0 -> | |
(forall n : nat, P n -> ev_dumb n /\ n <> 1 -> P (S (S n))) -> | |
forall n : nat, ev_dumb n -> P n. | |
Proof. |
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 #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE NoImplicitPrelude #-} | |
import Protolude hiding (for) | |
import GHC.Base (String) | |
import Pipes | |
import qualified Pipes.Prelude as P |
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 DeriveDataTypeable, DeriveGeneric, TupleSections #-} | |
import Data.Typeable | |
import Data.Aeson as Aeson | |
import Data.Text (Text) | |
import GHC.Generics | |
import qualified Data.HashMap.Lazy as LHM | |
newtype HStoreList = HStoreList {fromHStoreList :: [(Text,Text)]} deriving (Typeable, Eq, Show, Generic) | |
instance FromJSON HStoreList where |
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 BangPatterns, DataKinds, DeriveGeneric, FlexibleContexts, GADTs, OverloadedStrings, RecordWildCards, ScopedTypeVariables, TypeOperators #-} | |
module Lib | |
( fieldByName | |
, deserialize | |
) where | |
import Control.Monad.Extra | |
import Control.Monad.Reader | |
import Control.Monad.State | |
import Data.ByteString (ByteString) |
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 Main where | |
import LLVM.AST | |
import qualified LLVM.AST as AST | |
import LLVM.AST.AddrSpace | |
import qualified LLVM.AST.CallingConvention as CC | |
import qualified LLVM.AST.Constant as C | |
import LLVM.AST.Global | |
import LLVM.AST.Linkage | |
import LLVM.Context |
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
;;; core-modeline.el | |
;; This file tries to be an almost self-contained configuration of my mode-line. | |
;; | |
;; It depends on the following external packages: | |
;; + REQUIRED | |
;; + powerline | |
;; + evil-mode | |
;; + projectile | |
;; + DejaVu Mono for Powerline font <https://github.com/powerline/fonts> |
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
//===-- examples/clang-interpreter/main.cpp - Clang C Interpreter Example -===// | |
// | |
// The LLVM Compiler Infrastructure | |
// | |
// This file is distributed under the University of Illinois Open Source | |
// License. See LICENSE.TXT for details. | |
// | |
//===----------------------------------------------------------------------===// | |
#include "clang/CodeGen/CodeGenAction.h" |
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
import Test.Hspec | |
import Control.Exception | |
import Control.Concurrent | |
main :: IO () | |
main = | |
hspec $ | |
describe "it" $ | |
do it "should run" $ |