code
stringlengths
2
1.05M
repo_name
stringlengths
5
101
path
stringlengths
4
991
language
stringclasses
3 values
license
stringclasses
5 values
size
int64
2
1.05M
{-# LANGUAGE ConstraintKinds #-} module Mem where import Control.Applicative import Data.Traversable import SplitEval memInt :: (Int -> a) -> (Int -> a) memInt f = (map f [0..] !!) memIntA :: (Applicative m) => (Int -> m a) -> m (Int -> a) memIntA f = (!!) <$> traverse f [0..] memIntS :: (Applicative n, MonadEv...
vladfi1/hs-misc
PFP/Mem.hs
Haskell
mit
416
{-# LANGUAGE CPP #-} module Stackage.Config where import Control.Monad (when, unless) import Control.Monad.Trans.Writer (Writer, execWriter, tell) import Data.Char (toLower) import qualified Data.Map as Map import Data.Maybe ...
feuerbach/stackage
Stackage/Config.hs
Haskell
mit
29,848
{-# LANGUAGE OverloadedStrings #-} module Day15 where import Data.Either (rights) import Data.List (sortOn) import Text.Parsec ((<|>) , Parsec , ParseError) import qualified Text.Parsec as P data Disc = Disc { discIndex :: Int , discPositions :: Int , discOffset :: Int } deriving (Eq, Show) parseInpu...
brianshourd/adventOfCode2016
src/Day15.hs
Haskell
mit
1,957
-- This file is part of the 'union-find-array' library. It is licensed -- under an MIT license. See the accompanying 'LICENSE' file for details. -- -- Authors: Bertram Felgenhauer {-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies #-} {-# LANGUAGE FlexibleInstances, UndecidableInstances #-} module Control.Mona...
haskell-rewriting/union-find-array
src/Control/Monad/Union/Class.hs
Haskell
mit
1,408
module Data.Smashy.Types where import Control.Concurrent.STM (TVar, newTVarIO) import Control.Concurrent.STM.TQueue (TQueue, newTQueueIO) import Data.Hashable (Hashable, hashWithSalt) import Data.Vector.Storable (Vector) import...
jahaynes/smashy2
src/Data/Smashy/Types.hs
Haskell
mit
1,760
module AST where import qualified Data.Map as Map import Data.Semigroup type Name = String type Form = String data Pattern = Binding Name | Succ Pattern deriving (Show, Eq) data Param = FreeParam Name | LiteralParam Int | PatternParam Pattern | WildcardParam deriving (Show, E...
andreasfrom/natlang
AST.hs
Haskell
mit
1,674
import Data.List takemax n (x:xs) = if x > n then [] else x: (takemax n xs) main = print (foldl1 (+) (filter even (takemax 4000000 fibonacci))) where fibonacci = unfoldr (\(a, b) -> Just (a + b, (b, a + b))) (1, 1)
cptroot/ProjectEuler-Haskell
Euler2.hs
Haskell
mit
218
{-# LANGUAGE ForeignFunctionInterface #-} module System.Random.SplitMix.MathOperations ( c_mix32 , c_mix64 , c_mixGamma , xorShift33 ,) where import Data.Word (Word32, Word64) import Data.Bits (xor, shiftR) -- | Mixing fuction to produce 32 bit values as per the paper foreign import ccall unsafe "mix32" c_m...
nkartashov/SplitMix
src/System/Random/SplitMix/MathOperations.hs
Haskell
mit
895
{-# LANGUAGE ScopedTypeVariables, ViewPatterns, FlexibleContexts #-} {-| Module : Labyrinth.Pathing.Util Description : pathfinding utilities Copyright : (c) deweyvm 2014 License : MIT Maintainer : deweyvm Stability : experimental Portability : unknown Functions shared across different pathfinding algorit...
deweyvm/labyrinth
src/Labyrinth/Pathing/Util.hs
Haskell
mit
1,385
main = print getProblem15Value getProblem15Value :: Integer getProblem15Value = getNumberOfPaths 20 20 getNumberOfPaths :: Integer -> Integer -> Integer getNumberOfPaths x y = (fact (x+y)) `div` ((fact x) * (fact y)) fact :: Integer -> Integer fact 0 = 1 fact 1 = 1 fact x = x * (fact (x-1))
jchitel/ProjectEuler.hs
Problems/Problem0015.hs
Haskell
mit
296
{-# LANGUAGE CPP #-} {- ghcjs-run runs a program compiled by ghcjs with node.js -} module Main where import Control.Applicative import Data.Char import System.Directory import System.Environment import System.Exit import System.FilePath import System.Process main = do args <- getArgs path <- getExecutablePa...
ghcjs/ghcjs
src-bin/Run.hs
Haskell
mit
993
{-# LANGUAGE OverloadedStrings #-} {- | Module : $Header$ Description : Author : Nils 'bash0r' Jonsson Copyright : (c) 2015 Nils 'bash0r' Jonsson License : MIT Maintainer : aka.bash0r@gmail.com Stability : unstable Portability : non-portable (Portability is untested.) The 'Configuration' ...
aka-bash0r/headergen
src/Headergen/Configuration.hs
Haskell
mit
2,034
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE StrictData #-} {-# LANGUAGE TupleSections #-} -- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationreferencedatasource-referenceschema.html module Stratosphere.ResourceProperties.K...
frontrowed/stratosphere
library-gen/Stratosphere/ResourceProperties/KinesisAnalyticsApplicationReferenceDataSourceReferenceSchema.hs
Haskell
mit
4,548
module Ternary.Core.Kernel ( Kernel, FirstTwoSteps (Step0, Step1), serial, chain, zipKernelsWith, transformFirstTwo, iterateKernel) where -- A kernel is a machine with an internal state. This state is such a -- fundamental type here, that I decided not to hide it. type Kernel input output state = input -> stat...
jeroennoels/exact-real
src/Ternary/Core/Kernel.hs
Haskell
mit
1,843
{-# OPTIONS -fglasgow-exts #-} ----------------------------------------------------------------------------- {-| Module : QInputContext.hs Copyright : (c) David Harley 2010 Project : qtHaskell Version : 1.1.4 Modified : 2010-09-02 17:02:36 Warning : this file is machine generated - do...
keera-studios/hsQt
Qtc/Enums/Gui/QInputContext.hs
Haskell
bsd-2-clause
2,471
-- -- Copyright © 2014-2015 Anchor Systems, Pty Ltd and Others -- -- The code in this file, and the program it is a part of, is -- made available to you by its authors as open source software: -- you can redistribute it and/or modify it under the terms of -- the 3-clause BSD licence. -- -- | Description: Run /Synchron...
anchor/synchronise
lib/Synchronise/Program/Daemon.hs
Haskell
bsd-3-clause
690
{-# LANGUAGE DataKinds #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TypeOperators #-} module Api.Admin.UserAdmin ( UserAdminApi , userAdminHandlers ) where import Control.Monad.IO.Class (liftIO) import qualified Data.ByteString.Char8 as B import ...
pellagic-puffbomb/simpleservantblog
src/Api/Admin/UserAdmin.hs
Haskell
bsd-3-clause
3,471
-- | A type lattice for Python 3. module Language.Python.TypeInference.Analysis.TypeLattice ( UnionType (..), ValueType (..), BuiltinType (..), FunctionType (..), ClassType (..), InstanceType (..), HasClassId (..), Env, nabla, check, AType (..), oneType, filterType, ...
lfritz/python-type-inference
python-type-inference/src/Language/Python/TypeInference/Analysis/TypeLattice.hs
Haskell
bsd-3-clause
27,942
{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveFoldable #-} {-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE ViewPatterns #-} -- due to TypeDiff being a synonym: {-# LANGUAGE TypeSynonymInstances #-} {-# LANGUAGE Flex...
cdxr/haskell-interface
module-diff/Render.hs
Haskell
bsd-3-clause
8,749
{-# OPTIONS -fno-warn-tabs #-} -- The above warning supression flag is a temporary kludge. -- While working on this module you are encouraged to remove it and -- detab the module (please do the detabbing in a separate patch). See -- http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#TabsvsSpaces -- for...
nomeata/ghc
compiler/cmm/CmmCallConv.hs
Haskell
bsd-3-clause
6,497
{-# LANGUAGE RankNTypes #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE TypeFamilies #-} -- {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE NoMonomorphismRestriction #-} {-# LANGUAGE AllowAmbiguousT...
iu-parfunc/AutoObsidian
interface_brainstorming/06_ExtensibleEffects/newVer/Eff1.hs
Haskell
bsd-3-clause
32,804
module Common.NonBlockingQueueSpec (main, spec) where import Test.Hspec import Test.QuickCheck import qualified PolyGraph.Common.NonBlockingQueue.Properties as QProp spec :: Spec spec = do describe "NonBlockingQueue" $ do it "isFifo" $ property $ (QProp.isFifo :: [QProp.QueueInstruction Int] -> Bool)...
rpeszek/GraphPlay
test/Common/NonBlockingQueueSpec.hs
Haskell
bsd-3-clause
500
module D_Types where import Data.Word import Data.Int import Data.ByteString.Lazy import Data.Binary.Get data TypeDesc = TD (Int, String, [FieldDescTest], [TypeDesc]) -- id, name, fieldDescs, subtypes type FieldDesc = (String, [Something]) --name, data type FieldDescTest = (String, [Something], ByteString) ...
skill-lang/skill
src/main/resources/haskell/D_Types.hs
Haskell
bsd-3-clause
1,599
module Data.GeoJSON ( module Data.GeoJSON.Classes , module Data.GeoJSON.Position , module Data.GeoJSON.Geometries , module Data.GeoJSON.Features ) where import Data.GeoJSON.Classes import Data.GeoJSON.Features import Data.GeoJSON.Geometries import Data.GeoJSON.Position
alios/geojson-types
src/Data/GeoJSON.hs
Haskell
bsd-3-clause
316
{-# OPTIONS -fno-warn-orphans #-} {-# LANGUAGE FlexibleInstances #-} module Fay.Exts.NoAnnotation where import Fay.Compiler.Prelude import Data.List.Split (splitOn) import Data.String import qualified Language.Haskell.Exts.Annotated as A type Alt = A.Alt () type BangTyp...
beni55/fay
src/Fay/Exts/NoAnnotation.hs
Haskell
bsd-3-clause
1,946
{-# LANGUAGE OverloadedStrings #-} module Bead.View.Content.Notifications.Page ( notifications ) where import Control.Monad (forM_) import Data.String (fromString) import Text.Printf (printf) import qualified Bead.Controller.Pages as Pages import Bead.View.Content import ...
andorp/bead
src/Bead/View/Content/Notifications/Page.hs
Haskell
bsd-3-clause
5,478
{-# LANGUAGE FlexibleContexts, OverloadedStrings, RecordWildCards, ScopedTypeVariables, ConstraintKinds, PatternGuards #-} -- |The HTTP/JSON plumbing used to implement the 'WD' monad. -- -- These functions can be used to create your own 'WebDriver' instances, providing extra functionality for your application if desire...
wuzzeb/hs-webdriver
src/Test/WebDriver/Internal.hs
Haskell
bsd-3-clause
8,292
{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE BangPatterns #-} module Constraints.Set.Implementation ( ConstraintError(..), Variance(..), Inclusion, SetExpression(..), SolvedSystem, emptySet, universalSet, setVariable, atom, term, (<=!), solveSystem, leastS...
travitch/ifscs
src/Constraints/Set/Implementation.hs
Haskell
bsd-3-clause
17,569
{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE RecordWildCards #-} -- | Parses strings into a set of tokens using the given rules. module Youtan.Lexical.Tokenizer ( tokenize , tokenizeDrops , tokenizeT , tokenizeTDrops , Rules , Wrapper ) where import Control.Monad.State import Control...
triplepointfive/Youtan
src/Youtan/Lexical/Tokenizer.hs
Haskell
bsd-3-clause
2,884
{-# LANGUAGE ExistentialQuantification #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE PatternGuards #-} {-# LANGUAGE RecordWildCards #-} ----------------------------------------------------------------------------- -- | -- Module : Control.Distributed.Process.FSM.Internal.Pr...
haskell-distributed/distributed-process-fsm
src/Control/Distributed/Process/FSM/Internal/Process.hs
Haskell
bsd-3-clause
6,071
module H99.Arithmetic where import Data.List {- Problem 31 (**) Determine whether a given integer number is prime. Example: * (is-prime 7) T Example in Haskell: P31> isPrime 7 True -} isPrime :: Int -> Bool isPrime n = n `elem` (take n primes) where primes = filterPrime [2..] filterPrime (x:xs)...
1yefuwang1/haskell99problems
src/H99/Arithmetic.hs
Haskell
bsd-3-clause
5,883
{-# OPTIONS_GHC -fdefer-typed-holes #-} ---------------------------------------------------------------------------------------------------- -- | -- Module : Numeric.Algebra.Elementary.Pretty -- Copyright : William Knop 2015 -- License : BSD3 -- -- Maintainer : william.knop.nospam@gmail.com -- Portab...
altaic/algebra-elementary
src/Numeric/Algebra/Elementary/Pretty.hs
Haskell
bsd-3-clause
677
{-# LANGUAGE TypeFamilies #-} module QueryArrow.ElasticSearch.ESQL where -- http://swizec.com/blog/writing-a-rest-client-in-haskell/swizec/6152 import Prelude hiding (lookup) import Data.Map.Strict (lookup, fromList, Map, keys) import Data.Text (Text) import Data.Set (toAscList) import QueryArrow.Syntax.Term import...
xu-hao/QueryArrow
QueryArrow-db-elastic/src/QueryArrow/ElasticSearch/ESQL.hs
Haskell
bsd-3-clause
5,342
module Main (main) where import Test.Tasty import qualified TChunkedQueue import qualified TMChunkedQueue main :: IO () main = defaultMain $ testGroup "STM ChunkedQueues" [ testGroup "TChunkedQueue" TChunkedQueue.tests , testGroup "TMChunkedQueue" TMChunkedQueue.tests ]
KholdStare/stm-chunked-queues
tests/UnitTests.hs
Haskell
bsd-3-clause
301
module Capsir.Runtime where import Capsir import Data.Map (Map) import qualified Data.Map as Map import Data.Maybe (fromJust) -- | An instance of a continuation. Binds an environment to the -- continuation itself. data ContInst v = ContInst (Env v) Cont -- | A runtime value. Each variable is bound to one during cont...
naerbnic/capsir
src/Capsir/Runtime.hs
Haskell
bsd-3-clause
6,892
{-# LANGUAGE UnicodeSyntax #-} module System.Linux.Netlink.Internal ( align4 ) where import Data.Bits align4 ∷ (Num n, Bits n) ⇒ n → n align4 n = (n + 3) .&. complement 3 {-# INLINE align4 #-}
mvv/system-linux
src/System/Linux/Netlink/Internal.hs
Haskell
bsd-3-clause
209
{-# LANGUAGE OverloadedStrings #-} module Db.Mapper where import Control.Applicative import Database.MongoDB import Text.Read (readMaybe) import Types budgetToDocument :: Budget -> Document budgetToDocument (Budget bid uid i d f ds ob cb) = (idFieldIfExists bid) ++ [ "userId" =: uid , "income" ...
Geeroar/ut-haskell
src/Db/Mapper.hs
Haskell
apache-2.0
4,130
module Main where import VSimR.Timeline import VSimR.Memory import VSimR.Signal import VSimR.Variable -- main = do -- elab
ierton/vsim
Main.hs
Haskell
bsd-3-clause
142
{-# LANGUAGE OverloadedStrings #-} module Mimir.Bitfinex.Instances() where import Mimir.Types import Mimir.Bitfinex.Types import Control.Applicative ((<$>), (<*>)) import Control.Monad import Data.Aeson import Data.Aeson.Types (Parser) import Data.Char (toUpper) import qualified Data.HashMap.Strict as HM import Data...
ralphmorton/Mimir
src/Mimir/Bitfinex/Instances.hs
Haskell
bsd-3-clause
1,915
{-# OPTIONS_GHC -F -pgmF hspec-discover -optF --nested #-} -- import qualified FindSpec -- main :: IO () -- main = FindSpec.main
mkrauskopf/doh
test/main.hs
Haskell
bsd-3-clause
129
-- The @FamInst@ type: family instance heads {-# LANGUAGE CPP, GADTs #-} module FamInst ( FamInstEnvs, tcGetFamInstEnvs, checkFamInstConsistency, tcExtendLocalFamInstEnv, tcLookupFamInst, tcLookupDataFamInst, tcLookupDataFamInst_maybe, tcInstNewTyCon_maybe, tcTopNormaliseNewTyp...
forked-upstream-packages-for-ghcjs/ghc
compiler/typecheck/FamInst.hs
Haskell
bsd-3-clause
15,844
module A2 where data T a = C1 a | C2 Int addedC2 = error "added C2 Int to T" over :: (T b) -> b over (C1 x) = x over (C2 a) = addedC2
SAdams601/HaRe
old/testing/addCon/A2AST.hs
Haskell
bsd-3-clause
141
{-# Language RankNTypes #-} {-# Language DataKinds #-} {-# Language PolyKinds #-} {-# Language GADTs #-} {-# Language TypeFamilies #-} module T15874 where import Data.Kind data Var where Op :: Var Id :: Var type Varianced = (forall (var :: Var). Type) data family Parser :: Varianced data insta...
sdiehl/ghc
testsuite/tests/polykinds/T15874.hs
Haskell
bsd-3-clause
335
module Complex_Vectors (ComplexF, rootsOfUnity,thetas, norm,distance) where import Complex -- --import Strategies -- import Parallel type ComplexF = Complex Double rootsOfUnity:: Int -> [ComplexF] rootsOfUnity n =( zipWith (:+) cvar svar) -- (map cos (thetas n))- (map sin (thetas n)) where ...
RefactoringTools/HaRe
old/testing/evalMonad/Complex_Vectors.hs
Haskell
bsd-3-clause
800
{-# LANGUAGE GADTs #-} module Main where data T t a where T :: (Foldable t, Eq a) => t a -> T t a {-# NOINLINE go #-} go :: T [] a -> Int -> Int go (T _) i = foldr (+) 0 [1..i] main = print (go (T [1::Int]) 20000)
ezyang/ghc
testsuite/tests/perf/should_run/T5835.hs
Haskell
bsd-3-clause
219
{-# LANGUAGE TypeInType #-} module T9632 where import Data.Kind data B = T | F data P :: B -> * type B' = B data P' :: B' -> *
olsner/ghc
testsuite/tests/dependent/should_compile/T9632.hs
Haskell
bsd-3-clause
131
-- !!! Class and instance decl module Test where class K a where op1 :: a -> a -> a op2 :: Int -> a instance K Int where op1 a b = a+b op2 x = x instance K Bool where op1 a b = a -- Pick up the default decl for op2 instance K [a] where op3 a = a -- Oo...
ezyang/ghc
testsuite/tests/rename/should_fail/rnfail008.hs
Haskell
bsd-3-clause
348
------------------- -- This module defines the following common monads: -- -- SR - state reader monad -- State - (strict) state transformer monad -- IOS - IO monad with state -- Output - output monad -- CPS - continuation passing monad -- -- Most of these monads can be found in Wadler's papers abo...
jtestard/cse230Winter2015
SOE/haskore/src/Monads.hs
Haskell
mit
5,122
module Statistics.SGT.Util where sq :: (Num a) => a -> a sq n = n * n -- for use with non-Double args (//) :: Integral a => a -> a -> Double (//) a b = fromIntegral a / fromIntegral b dbl :: Integral a => a -> Double dbl = fromIntegral dblLog :: Integral a => a -> Double dblLog = log . dbl
marklar/Statistics.SGT
Statistics/SGT/Util.hs
Haskell
mit
295
{- Using textures instead of surfaces -} {-# LANGUAGE OverloadedStrings #-} module Lesson07 where -- import qualified SDL import Linear.V4 (V4(..)) -- import Control.Concurrent (threadDelay) import Control.Monad (unless,when) -- import qualified Config -- lesson07 :: IO () lesson07 = do SDL.initialize [SDL.InitVideo...
jaiyalas/sdl2-examples
src/Lesson07.hs
Haskell
mit
1,730
module Main where import Test.QuickCheck import Tictactoe.Base import Tictactoe.Move.Base import Tictactoe.Def.Move as DefMove import Tictactoe.Att.Move as AttMove import Tictactoe.Bencode.Encoder as Bencode import Tictactoe.Bencode.Decoder as Bencode import Tictactoe.BencodeDict.Encoder as BencodeDict import Tictacto...
viktorasl/tictactoe-bot
tests/Tictactoe/Tests.hs
Haskell
mit
2,972
----------------------------------------------------------- -- | -- module: C2HS.C.Extra.Marshal -- copyright: (c) 2016 Tao He -- license: MIT -- maintainer: sighingnow@gmail.com -- -- Convenient marshallers for complicate C types. -- {-# LANGU...
sighingnow/mxnet-haskell
c2hs-extra/src/C2HS/C/Extra/Marshal.hs
Haskell
mit
3,227
import qualified Data.ByteString.Lazy as LB import HaxParse.Parser import HaxParse.Options import HaxParse.Output import Options.Applicative import System.Exit import System.IO main :: IO () main = do opts <- execParser fullOpts res <- parseFile $...
pikajude/haxparse
src/Main.hs
Haskell
mit
607
module Main (main) where import Data.List (genericLength) import Data.Maybe (catMaybes) import System.Directory (doesFileExist) import System.Exit (exitFailure, exitSuccess) import System.Process (readProcess) import Text.Regex (matchRegex, mkRegex) average :: (Fractional a, Real b) => [b] -> a average xs = realToFra...
tfausak/haskeleton
package-name/test-suite/HPC.hs
Haskell
mit
1,152
{-# LANGUAGE NoImplicitPrelude #-} module Advent.Day1Spec (main, spec) where import Advent.Day1 import BasePrelude import Test.Hspec import Test.QuickCheck main :: IO () main = hspec spec spec :: Spec spec = do describe "day1Part1" $ do it "equal delimiters cancel out" $...
jhenahan/adventofcode
test/Advent/Day1Spec.hs
Haskell
mit
1,419
{-# LANGUAGE OverloadedStrings #-} module Y2021.M02.D18.Exercise where {-- We uploaded the reviews yesterday, but the unicoded wine-reviews also have an (optional) score and an (optional) price-point. We need to upload those data now, as well. --} import qualified Data.Text as T import Y2021.M02.D03.Solution (Revie...
geophf/1HaskellADay
exercises/HAD/Y2021/M02/D18/Exercise.hs
Haskell
mit
1,478
module Main where import Puzzle import Solver import System.TimeIt main :: IO () main = analyzeAndSolve oscarsPuzzle --main = analyzeAndSolve mediumPuzzle analyzeAndSolve :: Puzzle -> IO () analyzeAndSolve p = do analyzePuzzle p timeIt $ putStrLn $ show $ solve p timeIt $ putStrLn $ show $ take 100 $ sol...
johwerm/cube-solver
src/Main.hs
Haskell
mit
381
{-# OPTIONS_GHC -fno-warn-orphans #-} {-# LANGUAGE FlexibleInstances, MultiParamTypeClasses, InstanceSigs #-} module LinterUtility (linterSettings) where import Control.Applicative import Data.List.Utils import System.IO import Data.ConfigFile import CompilationUtility import qualified ConfigFile import Printer impo...
Prinhotels/goog-closure
src/LinterUtility.hs
Haskell
mit
1,748
import System.Random import Control.Monad(when) main = do gen <- getStdGen askForNumber gen askForNumber :: StdGen -> IO () askForNumber gen = do let (randNumber, newGen) = randomR (1,10) gen :: (Int, StdGen) putStr "Which number in the range from 1 to 10 am I thinking of? " ...
KHs000/haskellToys
src/scripts/guess_the_number.hs
Haskell
mit
604
module AlecSequences.A279966 (a279966) where import Tables.A274080 (a274080_row) import Data.List (genericIndex, genericLength) a279966 :: Integer -> Integer a279966 1 = 1 a279966 n = genericIndex a279966_list (n - 1) a279966_list :: [Integer] a279966_list = 1 : map count [2..] where count n = genericLength $ filte...
peterokagey/haskellOEIS
src/AlecSequences/A279966.hs
Haskell
apache-2.0
452
import Test.Tasty import Test.Tasty.HUnit import Text.ChordPro.Parser import Text.ChordPro.Types import Text.Trifecta main :: IO () main = defaultMain tests tests :: TestTree tests = testGroup "Tests" [unitTests] simpleLyric :: String simpleLyric = concat [ "[C]Cecilia, you're [F]breaking my [C]heart, you're " ...
relrod/chordpro
test/test.hs
Haskell
bsd-2-clause
950
{-# LANGUAGE TypeFamilies, RankNTypes, ScopedTypeVariables, ViewPatterns, BangPatterns #-} module OffLattice.HPChain where import OffLattice.Util import LA import qualified LA.Transform as T import qualified LA.Matrix as M import qualified OffLattice.Chain as C import qualified OffLattice.Shape as S import qua...
chalmers-kandidat14/off-lattice
OffLattice/HPChain.hs
Haskell
bsd-3-clause
8,233
module Main where import System.Environment import System.Exit import System.FilePath import System.FilePath.GlobPattern (GlobPattern, (~~)) import System.IO import System.FSNotify import Control.Monad (forever) import Control.Concurrent (threadDelay) import Data.Text (pack) import Data.Bits ((.&.)) main :: IO ()...
rob-b/hobbes
Hobbes.hs
Haskell
bsd-3-clause
1,327
module Evol.Algo.SGA ( ) where -- evil import Evil.EvoAlgorithm import Evil.Individual import Evil.Spaces import Evil.PPrintable import Evil.RandUtils -- vector import qualified Data.Vector as V newtype SGA = SGA instance EvoAlgorithm SGA () where initialize () gen = undefined nextGen = undefined
kgadek/evil-pareto-tests
src_old/Evol/Algo/SGA.hs
Haskell
bsd-3-clause
314
module YouTube.Services ( browseChannel , browseMyChannel , createPlaylist , createPlaylists , deletePlaylist , findChannel , insertVideo , listPlaylist , listVideos ) where import GoogleAPIsClient import Helpers (hashURL) import Model (Tournament(..)) import...
ptitfred/ftv-vods
src/YouTube/Services.hs
Haskell
bsd-3-clause
4,534
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE TupleSections #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# OPTIONS_HADDOCK -ignore-exports #-} -- | A simple OAuth2 Haskell binding. (This is supposed to be -- independent of the http client used.) module Network.OAuth.OAu...
reactormonk/hoauth2
src/Network/OAuth/OAuth2/Internal.hs
Haskell
bsd-3-clause
6,949
--------------------------------------------------------- -- -- Module : ErrorHandling -- Copyright : Bartosz Wójcik (2010) -- License : BSD3 -- -- Maintainer : bartek@sudety.it -- Stability : Unstable -- Portability : portable -- -- Error handling data structures, functions, etc. -...
bartoszw/haslo
Haslo/ErrorHandling.hs
Haskell
bsd-3-clause
5,551
{-# LANGUAGE FlexibleInstances, OverloadedStrings #-} module Data.Document ( FromDocument (..) , ToDocument (..) ) where import qualified Database.MongoDB as D import qualified Data.Time.Clock as T class FromDocument a where fromDocument :: D.Document -> a instance FromDocument a => Fro...
RobinKrom/BtcExchanges
src/Data/Document.hs
Haskell
bsd-3-clause
492
-- | Creating and rendering dot graphs that correspond to expression graphs. -- Each node has a single output and zero or more inputs. module Dot where import Language.Dot -- cabal install language-dot -- To generate an SVG file: -- -- dot -Tsvg file.dot -o file.svg -- -- Requires `graphviz` to be installed. ...
emilaxelsson/ag-graph
src/Dot.hs
Haskell
bsd-3-clause
2,914
module SimulationDSL ( module SimulationDSL.Language.EquationsDescription , module SimulationDSL.Language.Exp , module SimulationDSL.Data.ExpType , module SimulationDSL.Data.Scalar , module SimulationDSL.Data.Vector3 , module SimulationDSL.Data.Array , module SimulationDSL.Interpreter.SimMachine , modul...
takagi/SimulationDSL
SimulationDSL/SimulationDSL.hs
Haskell
bsd-3-clause
894
module Main where import Test.Hspec import Test.Hspec.HUnit import Test.HUnit import Data.Char import Data.Either import Data.Maybe import Chess import Chess.FEN import Control.Monad.Instances import Control.Monad assertNothing msg x = assertEqual msg Nothing x assertJust msg (Just x) = return () assertJust msg (Noth...
ArnoVanLumig/chesshs
ChessTest.hs
Haskell
bsd-3-clause
11,303
{-# OPTIONS_HADDOCK hide #-} -- | -- Module : Data.ByteString.Fusion -- License : BSD-style -- Maintainer : dons@cse.unsw.edu.au -- Stability : experimental -- Portability : portable -- -- Stream fusion for ByteStrings. -- -- See the paper /Stream Fusion: From Lists to Streams to Nothing at All/, -- Coutts,...
markflorisson/hpack
testrepo/bytestring-0.9.1.9/Data/ByteString/Fusion.hs
Haskell
bsd-3-clause
445
module SudokuParser(parseMatrix) where import Text.ParserCombinators.Parsec import Data.Char parseMatrix :: Parser [[Int]] parseMatrix = do result <- count 9 parseLine _ <- eof return result parseLine :: Parser [Int] parseLine = do result <- count 9 parseDigit _ <- eol ...
jaapterwoerds/algorithmx
src/SudokuParser.hs
Haskell
bsd-3-clause
576
module Game.Data( Game(..) ) where import GHC.Generics import Control.DeepSeq data Game = Game { gameExit :: Bool } deriving (Generic) instance NFData Game
Teaspot-Studio/gore-and-ash-game
src/client/Game/Data.hs
Haskell
bsd-3-clause
176
{-# LANGUAGE BangPatterns #-} {-# LANGUAGE ExistentialQuantification #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} module Criterion.Collection.Internal.Types ( Workload(..) , WorkloadGenerator , WorkloadMonad(..) , runWorkloadMonad , getRNG , DataStructure(..) , setupData , setupDataIO...
cornell-pl/HsAdapton
weak-hashtables/benchmark/src/Criterion/Collection/Internal/Types.hs
Haskell
bsd-3-clause
3,932
module EventLoop ( eventLoop ) where import Control.Monad (unless) import Graphics.UI.GLFW (Key (..), KeyState (..), Window, getKey, pollEvents, swapBuffers, windowShouldClose) -- | A simple rendering event loop which repeats the provided action until ...
psandahl/outdoor-terrain
src/EventLoop.hs
Haskell
bsd-3-clause
754
{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE TupleSections #-} module Language.Haskell.Liquid.Bare.DataType ( makeConTypes , makeTyConEmbeds , dataConSpec , meetDataConSpec ) where import DataCon import TyCon import Var import Control.Applicative ((<$>)) import Data.Maybe import Data.Monoid i...
abakst/liquidhaskell
src/Language/Haskell/Liquid/Bare/DataType.hs
Haskell
bsd-3-clause
5,429
{-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE UndecidableInstances #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE KindSignatures #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TypeOperators #-} module Plowtech.Service....
plow-technologies/template-service
src/Plowtech/Service/Types.hs
Haskell
bsd-3-clause
7,042
module Data.LLVM.Types.Identifiers ( -- * Types Identifier, -- * Accessor identifierAsString, identifierContent, isAnonymousIdentifier, -- * Builders makeAnonymousLocal, makeLocalIdentifier, makeGlobalIdentifier, makeMetaIdentifier ) where import Control.DeepSeq import Data.Hashable import Data...
travitch/llvm-base-types
src/Data/LLVM/Types/Identifiers.hs
Haskell
bsd-3-clause
2,587
module Main ( (|>) , (>>>) ) where import Operators ((|>), (>>>)) test :: [Int] -> Int test = foldr 1.0 (*) test2 :: a -> a -> ( a, a ) test2 = (,) (|>) :: a -> (a -> b) -> b (|>) v f = f v
hecrj/haskell-format
test/specs/operators/output.hs
Haskell
bsd-3-clause
221
{-# LANGUAGE ScopedTypeVariables, TypeFamilies, TupleSections #-} module Fuml.Core where import qualified Data.Vector.Storable as VS import Numeric.LinearAlgebra import Data.List (nub) import Lens.Micro import Control.Monad.Identity data Weighted o = Weighted Double o -- |The result of running a predictive model da...
diffusionkinetics/open
fuml/lib/Fuml/Core.hs
Haskell
mit
1,869
-- HACKERRANK: Super Digit -- https://www.hackerrank.com/challenges/super-digit module Main where digits :: Integer -> [Integer] digits 0 = [] digits n = m : rest where m = mod n 10 rest = digits (div n 10) solve :: Integer -> Integer solve n = if n < 10 then n else solve $ sum $ digits ...
everyevery/programming_study
hackerrank/functional/super-digit/super-digit.hs
Haskell
mit
516
{-# LANGUAGE DeriveDataTypeable, CPP #-} ----------------------------------------------------------------------------- -- | -- Module : Signal -- Copyright : (c) Andrea Rosatto -- : (c) Jose A. Ortega Ruiz -- : (c) Jochen Keil -- License : BSD-style (see LICENSE) -- -- Maintaine...
tsiliakis/xmobar
src/Signal.hs
Haskell
bsd-3-clause
1,955
{-# LANGUAGE OverloadedStrings #-} module Site.Blog ( rules ) where import Control.Monad import Data.Monoid import Hakyll import System.FilePath import Site.Config import Site.Compilers -- | Blog post page blogPostPage :: Tags -> Pipeline String String blogPostPage tags = prePandoc >=> pandoc ...
piyush-kurur-pages/website
Site/Blog.hs
Haskell
bsd-3-clause
3,238
----------------------------------------------------------------------------- -- | -- Module : Data.Permute.IO -- Copyright : Copyright (c) , Patrick Perry <patperry@stanford.edu> -- License : BSD3 -- Maintainer : Patrick Perry <patperry@stanford.edu> -- Stability : experimental -- -- Mutable permutations in t...
patperry/permutation
lib/Data/Permute/IO.hs
Haskell
bsd-3-clause
568
-- Copyright (c) 2015-2020 Rudy Matela. -- Distributed under the 3-Clause BSD licence (see the file LICENSE). {-# LANGUAGE TemplateHaskell, CPP #-} import Test -- import Test.LeanCheck -- already exported by Test import Test.LeanCheck.Derive import System.Exit (exitFailure) import Data.List (elemIndices,sort) import Te...
rudymatela/leancheck
test/derive.hs
Haskell
bsd-3-clause
4,696
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE helpset PUBLIC "-//Sun Microsystems Inc.//DTD JavaHelp HelpSet Version 2.0//EN" "http://java.sun.com/products/javahelp/helpset_2_0.dtd"> <helpset version="2.0" xml:lang="ur-PK"> <title>Plug-n-Hack | ZAP Extension</title> <maps> <homeID>top</homeID> <mapref ...
thc202/zap-extensions
addOns/plugnhack/src/main/javahelp/org/zaproxy/zap/extension/plugnhack/resources/help_ur_PK/helpset_ur_PK.hs
Haskell
apache-2.0
972
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE ViewPatterns #-} module Stack.Types.Compiler where import Control.DeepSeq import Control.DeepSeq.Generics (genericRnf) import Data.Aeson import Data.Binary (Binary) import Data.Monoid ((<>)...
akhileshs/stack
src/Stack/Types/Compiler.hs
Haskell
bsd-3-clause
2,898
module E.Eta( ArityType(ATop,ABottom), etaExpandAp, annotateArity, deleteArity, etaExpandDef, etaExpandDef', etaExpandProgram, getArityInfo, etaAnnotateProgram, etaReduce ) where import Control.Monad.Identity import Control.Monad.State import Control.Monad.Writer import Data...
m-alvarez/jhc
src/E/Eta.hs
Haskell
mit
7,993
module LiftOneLevel.LetIn1 where --A definition can be lifted from a where or let into the surronding binding group. --Lifting a definition widens the scope of the definition. --In this example, lift 'sq' in 'sumSquares' --This example aims to test lifting a definition from a let clause to a where clause, --and the e...
RefactoringTools/HaRe
test/testdata/LiftOneLevel/LetIn1.hs
Haskell
bsd-3-clause
536
{-# LANGUAGE PatternGuards #-} module Idris.Elab.Transform where import Idris.AbsSyntax import Idris.ASTUtils import Idris.DSL import Idris.Error import Idris.Delaborate import Idris.Imports import Idris.Coverage import Idris.DataOpts import Idris.Providers import Idris.Primitives import Idris.Inliner import Idris.Par...
osa1/Idris-dev
src/Idris/Elab/Transform.hs
Haskell
bsd-3-clause
4,686
{- | Module : Orville.PostgreSQL.Internal.EntityOperations Copyright : Flipstone Technology Partners 2021 License : MIT -} module Orville.PostgreSQL.Internal.EntityOperations ( insertEntity, insertAndReturnEntity, insertEntities, insertAndReturnEntities, updateEntity, updateAndReturnEntity, ...
flipstone/orville
orville-postgresql-libpq/src/Orville/PostgreSQL/Internal/EntityOperations.hs
Haskell
mit
6,679
import qualified Data.Array.Unboxed as A import Data.Char ones :: A.Array Int String ones = A.listArray (0,9) ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"] tens :: A.Array Int String tens = A.listArray (1,9) ["ten", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty",...
jwtouron/haskell-play
ProjectEuler/Problem17.hs
Haskell
mit
1,455
module MyHttp (RequestType (..), Request(..), Response(..), Context(..), ServerPart, choose) where --import Control.Monad --import Control.Applicative data RequestType = Get | Post deriving (Eq) data Request = Request { route :: String , reqtype :: RequestType } data Response = Response { content :...
nicolocodev/learnhappstack
4_Filters/MyHttp.hs
Haskell
mit
845
{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TupleSections #-} {- | Module : Database.Couch.Explicit.Database Description : Database-oriented requests to CouchDB, with explicit parameters Copyright : Copyright (c) 2015, Michael Alan Dorman License : MIT Maintainer ...
mdorman/couch-simple
src/lib/Database/Couch/Explicit/Database.hs
Haskell
mit
19,367
{-# LANGUAGE NoImplicitPrelude, OverloadedStrings, ScopedTypeVariables #-} module Main (main) where import ClassyPrelude import Network.HTTP.Types (status400) import Network.Wai (Application, responseLBS) import Network.Wai.Handler.Warp (run) import Network.Wai.Handler.WebSockets (websocketsOr) import qualified Contr...
palkan/websocket-shootout
haskell/warp/Main.hs
Haskell
mit
1,672
{-# LANGUAGE DeriveLift #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TemplateHaskell #-} {-# OPTIONS_GHC -fno-warn-missing-fields #-} module Luck.Template ( mkGenQ , TProxy (..) , tProxy1 , tProxy2 , tProxy3 , Flags (..) , defFlags ) where import Common.SrcLoc (SrcLoc(..)) import Common.Types ...
QuickChick/Luck
luck/src/Luck/Template.hs
Haskell
mit
2,723
module Parse ( program , expr ) where import Control.Applicative hiding (many, (<|>)) import Data.Char import Text.ParserCombinators.Parsec import qualified PowAST as Ast -- We have many fun !! program :: Parser Ast.Program program = do funs <- many fun _ <- eof return funs fun :: Parser Ast.Fun fun = do ...
rloewe/petulant-octo-wallhack
Parse.hs
Haskell
mit
4,931
module HelperSequences.A000037Spec (main, spec) where import Test.Hspec import HelperSequences.A000037 (a000037) main :: IO () main = hspec spec spec :: Spec spec = describe "A000037" $ it "correctly computes the first 20 elements" $ take 20 (map a000037 [1..]) `shouldBe` expectedValue where expectedValue...
peterokagey/haskellOEIS
test/HelperSequences/A000037Spec.hs
Haskell
apache-2.0
379
{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, FlexibleInstances #-} module Language.C.Obfuscate.CPS where import Data.Char import Data.List (nubBy) import Data.Maybe import qualified Data.Map as M import qualified Data.Set as S import qualified Language.C.Syntax.AST as AST import qualified Languag...
luzhuomi/cpp-obs
Language/C/Obfuscate/CPS_old.hs
Haskell
apache-2.0
58,743