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
fft :: [[Integer]] -> [Integer] -> Integer -> Integer -> Integer -> Integer | |
fft as rho m mM sig pc = ... cooleyTukey bs (rhoMult m mM) (mM `div` mM) ... | |
where Ibs = zipWith (badMult m mM sig pc) pr as | |
pr = powersOfRho (m * 2) rho m mM sig pc | |
data Constants = C { mM :: Integer, sig :: Integer, pc :: Integer} | |
fft :: [[Integer]] -> [Integer] -> Integer -> Integer -> Integer -> Integer | |
fft as rho m mM sig pc = runReader fft' (Constants mM sig pc) |
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.Char | |
import Data.Maybe | |
import Data.List | |
import Data.Map hiding (map) | |
import Text.Printf | |
main :: IO () | |
main = do | |
(src :: String) <- readFile "grades.txt" :: IO String | |
let pairs = map (\x -> split (words x)) ((lines src) :: [String]) :: [(String,Int)] |
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
data BTree a | |
= Null | |
| Leaf a | |
| Node a (BTree a) (BTree a) | |
deriving (Show) | |
-- makeTree :: [a] -> BTree a | |
-- makeTree xs = | |
instance Binary a => Binary (BTree a) where |
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 ConstraintKinds, DataKinds, PolyKinds, TypeFamilies, | |
TypeOperators, RankNTypes, TypeFamilies, UndecidableInstances #-} | |
import GHC.Prim (Constraint) | |
import Control.Exception -- (Exception, SomeException, catch, throw) | |
newtype Throws (es :: [k]) a = Throws (IO a) | |
type family Contains (e :: k) (es :: [k]) :: Constraint where |
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 ConstraintKinds, DataKinds, PolyKinds, TypeFamilies, | |
TypeOperators, RankNTypes, TypeFamilies, UndecidableInstances #-} | |
import GHC.Prim (Constraint) | |
import Control.Exception -- (Exception, SomeException, catch, throw) | |
import Control.Monad (ap) | |
type family If (b :: Bool) :: Constraint where |
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 ConstraintKinds, TypeFamilies #-} | |
{-# LANGUAGE RebindableSyntax #-} | |
-- {-# LANGUAGE NoImplicitPrelude #-} | |
{-# LANGUAGE AllowAmbiguousTypes #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
import Data.Set (Set, unions, toList, singleton) | |
import qualified Data.Set as S | |
import GHC.Prim |
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
<snippet> | |
<!-- | |
Produces imports of the form: | |
import qualified Data.Foo as F | |
import Data.Foo (Foo, fun) | |
Foo and F in as and includes sections are determined by the last | |
name in the module string: Foo -> F and Foo, Data.Foo -> F and Foo | |
--> |
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 #-} | |
import Data.Bits | |
import Data.Word | |
nlz :: Word64 -> Int | |
nlz x = go x x 0 where | |
go !x !y !n | |
| x < 0 = n | |
| y == 0 = 64 - n |
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
/* Similar to scavenge_large_bitmap(), but we don't write back the | |
* pointers we get back from evacuate(). | |
*/ | |
#define SPARSE_BITS 8 | |
static void | |
scavenge_large_srt_bitmap( StgLargeSRT *large_srt ) | |
{ | |
nat i, j, size; |
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 KindSignatures #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE EmptyDataDecls #-} | |
{-# LANGUAGE MagicHash #-} | |
{-# LANGUAGE TupleSections #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
OlderNewer