This file contains hidden or 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 MagicHash #-} | |
{-# LANGUAGE RecordWildCards #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE UnboxedTuples #-} | |
import GHC.IO.Handle.Internals | |
import GHC.IO.Exception | |
import GHC.Ptr | |
import GHC.IO |
This file contains hidden or 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 Data.List (sort) | |
type Pairs = [(Double,Double)] | |
type Measure = [Double] -> Double | |
midpoints :: Pairs -> [Double] | |
midpoints = map (\(x, y) -> (x + y) / 2) | |
mean :: Measure |
This file contains hidden or 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 #-} | |
{-# LANGUAGE RecordWildCards #-} | |
module Main where | |
import Data.Aeson | |
import qualified Data.ByteString.Lazy.Char8 as LBSC8 |
This file contains hidden or 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 Example (main) where | |
import Data.IORef | |
import Data.Primitive | |
import Data.Primitive.PrimArray | |
import GHC.Prim (RealWorld) | |
main :: IO () | |
main = do | |
let len = 30 |
This file contains hidden or 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
{-# OPTIONS_GHC -fforce-recomp -ddump-simpl -fno-worker-wrapper -dsuppress-all #-} | |
module Main (main) where | |
import System.Environment (getArgs) | |
main :: IO () | |
main = do | |
[x,y] <- map read <$> getArgs | |
let f1 = f x A B |
This file contains hidden or 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
combine :: Monoid e | |
=> (a -> Either e r1) | |
-> (b -> Either e r2) | |
-> (a,b) | |
-> Either (Either e1 (e1,e2)) (r1,r2) | |
combine fa fb (a,b) = | |
let faa = fa a | |
fbb = fb b | |
in case faa of | |
Left e1 -> Left (Left e1) |
This file contains hidden or 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
# Install not only the Hoogle library and executable, but also a local Hoogle | |
# database which provides "Source" links to all specified 'packages' -- or the | |
# current Haskell Platform if no custom package set is provided. | |
# | |
# It is intended to be used in config.nix similarly to: | |
# | |
# { packageOverrides = pkgs: rec { | |
# | |
# haskellPackages = | |
# let callPackage = pkgs.lib.callPackageWith haskellPackages; |
This file contains hidden or 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
{ config, lib, pkgs, ... }: | |
with lib; | |
let | |
cfg = config.services.choogle; | |
hoogleEnv = pkgs.buildEnv { | |
name = "hoogle"; |
This file contains hidden or 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 #-} | |
{-# language ScopedTypeVariables #-} | |
{-# language UnboxedTuples #-} | |
module Array (mapMaybe) where | |
import Control.Monad.ST | |
import Data.Primitive.Array | |
data Alls = AllNothing | NotAllNothing |
This file contains hidden or 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
reverseBits :: Word8 -> Word8 | |
reverseBits b' = | |
let b = fromIntegral b' :: Word32 | |
!x = ((((b * 0x0802 .&. 0x22110) .|. ((b * 0x8020) .&. 0x88440)) * 0x10101) `unsafeShiftR` 16 | |
in fromIntegral x |