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 FlexibleContexts #-}
module TypeCheck where
import Control.Monad.Except
import Control.Monad.Reader
import Data.List
import Text.Printf
type TypeVar = String
data Type = Type :->: Type
| TVar TypeVar
| ForAll TypeVar Type
deriving (Show)
infixr :->:
instance Eq Type wh... | SergeevPavel/system-f-typecheck | src/TypeCheck.hs | Haskell | bsd-3-clause | 4,261 |
{-# language CPP #-}
-- No documentation found for Chapter "BufferView"
module Vulkan.Core10.BufferView ( createBufferView
, withBufferView
, destroyBufferView
, BufferViewCreateInfo(..)
... | expipiplus1/vulkan | src/Vulkan/Core10/BufferView.hs | Haskell | bsd-3-clause | 20,307 |
module BowlingKata.Day6Spec (spec) where
import Test.Hspec
import BowlingKata.Day6 (score)
spec :: Spec
spec = do
it "is a gutter game"
((score . replicate 20 $ 0) == 0)
it "rolls all ones"
((score . replicate 20 $ 1) == 20)
it "rolls one spare"
... | Alex-Diez/haskell-tdd-kata | old-katas/test/BowlingKata/Day6Spec.hs | Haskell | bsd-3-clause | 537 |
{-# LANGUAGE BangPatterns #-}
module BinaryHeapSTMSpec where
import Control.Concurrent.STM
import Data.IORef (readIORef)
import Data.List (group, sort)
import Test.Hspec
import qualified BinaryHeapSTM as P
spec :: Spec
spec = do
describe "base priority queue" $ do
it "queues entries based on weight" $ d... | kazu-yamamoto/http2 | bench-priority/test/BinaryHeapSTMSpec.hs | Haskell | bsd-3-clause | 1,801 |
{-- snippet all --}
module PodParser where
import PodTypes
import Text.XML.HaXml
import Text.XML.HaXml.Parse
import Text.XML.HaXml.Html.Generate(showattr)
import Data.Char
import Data.List
data Item = Item {itemtitle :: String,
enclosureurl :: String
}
deriving (Eq, Show,... | binesiyu/ifl | examples/ch23/PodParser.hs | Haskell | mit | 3,472 |
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
-- Note: this file may contain spoilers
-- (although I would be really surprised if it did, I haven't seen the films... | kcsongor/generic-lens | generic-optics/examples/StarWars.hs | Haskell | bsd-3-clause | 1,786 |
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE TypeOperators #-}
module CommonServer where
import Data.Aeson
import GHC.Generics
------------------------------
-- File Structure
------------------------------
data File = File {
fileName :: FilePath,
... | Coggroach/Gluon | .stack-work/intero/intero8374TU0.hs | Haskell | bsd-3-clause | 2,366 |
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# OPTIONS_GHC -fno-warn-deprecations #-}
module Network.Wai.Handler.Warp.Request (
recvRequest
, headerLines
, pauseTimeoutKey
, getFileInfoKey
, getClientCertificateKey
, NoKeepAli... | kazu-yamamoto/wai | warp/Network/Wai/Handler/Warp/Request.hs | Haskell | mit | 12,688 |
{-
(c) The GRASP/AQUA Project, Glasgow University, 1993-1998
\section[WwLib]{A library for the ``worker\/wrapper'' back-end to the strictness analyser}
-}
{-# LANGUAGE CPP #-}
module WwLib ( mkWwBodies, mkWWstr, mkWorkerArgs
, deepSplitProductType_maybe, findTypeShape
) where
#include "HsVersions.h"
... | nushio3/ghc | compiler/stranal/WwLib.hs | Haskell | bsd-3-clause | 31,859 |
-- |Auxiliary functions to vectorise type abstractions.
module Vectorise.Utils.Poly
( polyAbstract
, polyApply
, polyVApply
, polyArity
)
where
import GhcPrelude
import Vectorise.Vect
import Vectorise.Monad
import Vectorise.Utils.PADict
import CoreSyn
import Type
import FastString
import Control.Monad
--... | ezyang/ghc | compiler/vectorise/Vectorise/Utils/Poly.hs | Haskell | bsd-3-clause | 2,148 |
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE Record... | fpinsight/hadron | src/Hadron/Basic.hs | Haskell | bsd-3-clause | 9,521 |
<?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="si-LK">
<title>Directory List v2.3</title>
<maps>
<homeID>directorylistv2_3</homeID>
<m... | thc202/zap-extensions | addOns/directorylistv2_3/src/main/javahelp/help_si_LK/helpset_si_LK.hs | Haskell | apache-2.0 | 978 |
{-# LANGUAGE FlexibleContexts, BangPatterns #-}
import Data.Array.Repa
import Data.Array.Repa.IO.DevIL
import System.Environment
import Data.Array.Repa.Repr.ForeignPtr
import Data.Word
-- <<main
main :: IO ()
main = do
[n, f1,f2] <- getArgs
runIL $ do
(RGB v) <- readImage f1 ... | lywaterman/parconc-examples | rotateimage.hs | Haskell | bsd-3-clause | 1,427 |
module Way.Type where
import Data.IntSet (IntSet)
import qualified Data.IntSet as Set
import Data.List
import Data.Maybe
import Development.Shake.Classes
import Hadrian.Utilities
-- Note: order of constructors is important for compatibility with the old build
-- system, e.g. we want "thr_p", not "p_thr" (see instance... | bgamari/shaking-up-ghc | src/Way/Type.hs | Haskell | bsd-3-clause | 2,727 |
import System.IO
import System.Cmd
import System.FilePath
import Text.Printf
import System.Directory
import Control.Monad
testdir = "openFile008_testdir"
-- Test repeated opening/closing of 1000 files. This is useful for guaging
-- the performance of open/close and file locking.
main = do
system ("rm -rf " ++ test... | urbanslug/ghc | libraries/base/tests/IO/openFile008.hs | Haskell | bsd-3-clause | 585 |
-- file ch03/ex05.hs
-- Write a function that determines whether its input list is a palindrome.
isPali :: (Eq a) => [a] -> Bool
isPali [] = True
isPali (x:[]) = True
isPali (x:xs) = x == last(xs) && isPali(init xs)
-- init is defined as: init (xs) = take (length xs - 1) xs | imrehg/rwhaskell | ch03/ex05.hs | Haskell | mit | 274 |
{-# LANGUAGE PackageImports #-}
{-# LANGUAGE RecordWildCards, NamedFieldPuns #-}
{-# LANGUAGE FlexibleContexts #-}
--{-# LANGUAGE NoMonomorphismRestriction #-}
module Sudoku where
import Data.Set (Set)
import qualified Data.Set as Set
import Data.Map (Map)
import qualified Data.Map as Map
import "mtl" Control.Monad... | vladfi1/hs-misc | Sudoku.hs | Haskell | mit | 2,098 |
{-# LANGUAGE DeriveGeneric #-}
import GHC.Generics (Generic)
import Data.Hashable
data Color = Red | Green | Blue deriving (Generic, Show)
instance Hashable Color where
example1 :: Int
example1 = hash Red
-- 839657738087498284
example2 :: Int
example2 = hashWithSalt 0xDEADBEEF Red
-- 62679985974121021
| riwsky/wiwinwlh | src/hashable.hs | Haskell | mit | 308 |
module PuzzleIO where
import Data.Char
import Data.Matrix
type Puzzle = Matrix (Maybe Int)
showPuzzle = unlines . (map showRow) . toLists
showRow = unwords . map showNumber
showNumber :: Maybe Int -> String
showNumber (Just n) = show n
showNumber Nothing = "-"
readPuzzle :: IO Puzzle
readPuzzle = do
lines <- se... | matthayter/haskell_sudoku | PuzzleIO.hs | Haskell | mit | 600 |
module ARD.World where
import ARD.Camera
import ARD.Color
import ARD.Light
import ARD.Randomize
import ARD.Ray
import ARD.Shape
import ARD.ViewPlane
data World
= World
{ camera :: Camera
, viewPlane :: ViewPlane
, sceneObjects :: [Shape]
, lights :: [Light]
, ambientLight :: Light
, backgroundColor :: C... | crazymaik/ard-haskell | lib/ARD/World.hs | Haskell | mit | 356 |
{-# LANGUAGE FlexibleContexts, UndecidableInstances #-}
-----------------------------------------------------------------------------
--
-- Module : RunID3Weka
-- Copyright :
-- License : MIT
--
-- Maintainer :
-- Stability :
-- Portability :
--
-- |
--
-------------------------------------------------... | fehu/min-dat--decision-trees | src/RunID3Weka.hs | Haskell | mit | 4,305 |
module JSON where
import Text.JSON
import DB0
import DB.Get
import DB0
instance JSON Event where
showJSON (EvNewMessage mid) = makeObj [("newmessage",JSRational False $ fromIntegral mid)]
showJSON _ = JSNull
instance JSON Exposed where
showJSON (Exposed mid mdate mpid mtext mvote fs (Interface cv cp ci ... | paolino/mootzoo | JSON.hs | Haskell | mit | 1,031 |
module Parser where
import Monad
import Types
import Data.Maybe (fromJust)
import Options.Applicative
import Options.Applicative.Types (ReadM (..), readerAsk, readerError)
fullParser :: Parser Args
fullParser = argParser
uriReadM :: ReadM URI
uriRe... | NorfairKing/hess | src/Parser.hs | Haskell | mit | 1,882 |
-- |
-- Module : Text.XML.Mapping.Schema.Mixed
-- Copyright : (c) Joseph Abrahamson 2013
-- License : MIT
-- .
-- Maintainer : me@jspha.com
-- Stability : experimental
-- Portability : non-portable
-- .
-- XML \"mixed\" content.
module Text.XML.Mapping.Schema.Mixed (
Mixed (Mixed, unMixed), textOnly, ... | tel/xml-mapping | src/Text/XML/Mapping/Schema/Mixed.hs | Haskell | mit | 633 |
module Main where
import qualified Data.ByteString.Lazy as Bs
import Data.List
import Data.Word (Word8)
import Data.Bits
import Data.Ord (comparing)
import System.Exit
import System.Environment
import System.Console.GetOpt
import Control.Monad.Error
data RleCode = EqRle {len::Int, byte::Word8}
| ... | romhack/eintourname | eintourname.hs | Haskell | mit | 5,824 |
module HConsole where
import Block
import Mino
import Graphics.Gloss
-- constants
scorePaneBackgroundColor, scorePaneBorderColor, scorePaneTextColor :: Color
scorePaneWidth, scorePaneInnerWidth, scorePaneHeight, scorePaneInnerHeight, scoreTextScale :: Float
scorePaneTextLocation, scorePaneBoxLocation, scorePaneLabel... | maple-shaft/HaskellTetris | src/HConsole.hs | Haskell | mit | 6,272 |
{-# LANGUAGE ScopedTypeVariables #-}
import Gauge.Main
import qualified Data.ByteString.Char8 as S
import qualified Data.ByteString.Builder as BB
import Data.Monoid
import qualified Data.Streaming.ByteString.Builder as BB
main :: IO ()
main = defaultMain [ bgroup "Data.Streaming.ByteString.Builder.toByteStringIO"
... | fpco/streaming-commons | bench/builder-to-bytestring-io.hs | Haskell | mit | 1,310 |
--
-- Manage asynchronous evaluation tasks
--
module Codex.Tasks (
TaskGroup, Queue,
createTaskGroup, forkTask,
createQueue, addQueue, cancelAll
) where
import Control.Monad.IO.Class
import Control.Concurrent
import Control.Exception (bracket_)
-- | a task group
-- a quantit... | pbv/codex | src/Codex/Tasks.hs | Haskell | mit | 1,210 |
module Nagari where
import Control.Monad
import Data.Char
import qualified Data.List as L
import Data.Monoid
import Prelude hiding (filter, iterate, take, takeWhile, map)
import qualified Prelude as P
----------------
-- Data types --
----------------
-- | Parser combinator type.
newtype Parser a = Parser { runParse... | davesque/nagari | Nagari.hs | Haskell | mit | 5,631 |
module Alder.Unique
( -- * Unique values
Unique
-- * Supplying 'Unique's
, MonadSupply(..)
-- * Tagging values
, Tagged(..)
, tag
, untag
) where
import Control.Monad
type Unique = Int
class Monad m => MonadSupply m where
getUnique :: m Unique
data Tagged a = !Unique :<... | ghcjs/ghcjs-sodium | src/Alder/Unique.hs | Haskell | mit | 440 |
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TupleSections #-}
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-trigger-action.html
module Stratosphere.ResourceProperties.GlueTriggerAction where
import Stratosphere.... | frontrowed/stratosphere | library-gen/Stratosphere/ResourceProperties/GlueTriggerAction.hs | Haskell | mit | 1,688 |
{-# htermination (inRangeChar :: Tup2 Char Char -> Char -> MyBool) #-}
import qualified Prelude
data MyBool = MyTrue | MyFalse
data List a = Cons a (List a) | Nil
data Tup2 a b = Tup2 a b ;
data Char = Char MyInt ;
data MyInt = Pos Nat | Neg Nat ;
data Nat = Succ Nat | Zero ;
data Ordering = LT | EQ | G... | ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/inRange_2.hs | Haskell | mit | 1,938 |
{-# LANGUAGE OverloadedStrings, Arrows #-}
module Main where
import Text.XML.HXT.Core
import qualified Data.ByteString.Lazy.Char8 as BL
import Data.List
import Text.XML.HXT.Arrow.XmlState.RunIOStateArrow
import Text.XML.HXT.Arrow.XmlState.TypeDefs
type ImgState = [Image]
type ImgArrow = IOSLA (XIOState ImgState) Xml... | danchoi/datauri | Main.hs | Haskell | mit | 1,775 |
module Main where
factors :: Int -> [Int]
factors n = [x | x <- [1..n], n `mod` x == 0]
prime :: Int -> Bool
prime n = factors n == [1, n]
primesTo :: Int -> [Int]
primesTo n = [x | x <- [2..n], prime x]
| Crossroadsman/ProgrammingInHaskell | 05/primes.hs | Haskell | apache-2.0 | 231 |
module Main ( main ) where
import Control.Eff.Exception
import Control.Eff.Lift
import System.Environment ( getArgs )
import Codec.FFMpeg
import Codec.FFMpeg.Format
probe :: String -> IO ()
probe fn = do
putStrLn fn
me <- runLift $ runExc (openInput fn (return (1 :: Int)))
case me of
Left e ->... | waldheinz/ffmpeg-effects | demos/Probe.hs | Haskell | apache-2.0 | 447 |
{-# LANGUAGE FlexibleContexts #-}
import qualified Data.Text as T
import qualified Data.ByteString as B
import JtagRW ( UsbBlasterState
, withUSBBlaster
, toBits, fromBits
, virWrite, vdrWrite, vdrWriteRead
... | tau-tao/FPGAIPFilter | test/FtdiTest1.hs | Haskell | bsd-3-clause | 1,437 |
{-# LANGUAGE DeriveDataTypeable #-}
module Text.RE.Internal.QQ where
import Control.Exception
import Data.Typeable
import Language.Haskell.TH.Quote
data QQFailure =
QQFailure
{ _qqf_context :: String
, _qqf_component :: String
}
deriving (Show,Typeable)
insta... | cdornan/idiot | Text/RE/Internal/QQ.hs | Haskell | bsd-3-clause | 646 |
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Linear.Extra.Random where
import Control.Monad.Random
import Linear
import Control.Lens
instance Random r => Random (V2 r) where
randomR (a,b) g = flip runRand g $ do
x <- getRandomR (a^._x,b^._x)
y <- getRandomR (a^._y,b^._y)
return (V2 x y)
... | lukexi/linear-extra | src/Linear/Extra/Random.hs | Haskell | bsd-3-clause | 1,196 |
{-# LANGUAGE TemplateHaskell #-}
module Render.MEdgeT where
import Data.Word (Word16)
import Control.Lens (makeLenses)
import qualified Data.ByteString.Lazy as BL
import Types
import Util.Binary
import qualified Constants
mEdgeDiskSize :: Int
mEdgeDiskSize = 2 * Constants.sizeOfShort
makeLenses ''MEdgeT
newMEdgeT ... | ksaveljev/hake-2 | src/Render/MEdgeT.hs | Haskell | bsd-3-clause | 529 |
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}
-- | Interface between OpenCV and inline-c(pp) (Haskell)
module OpenCV.Internal.C.Inline ( openCvCtx ) where
import "base" Foreign.Ptr ( FunPtr )
import "base" Data.Monoid ( (<>) )
import qualified "containers" Data.Map as M
import qualified "inline-c"... | Cortlandd/haskell-opencv | src/OpenCV/Internal/C/Inline.hs | Haskell | bsd-3-clause | 5,328 |
{-# LANGUAGE CPP #-}
---------------------------------------------------------------------------
-- |
-- Copyright : (C) 2015 Edward Kmett
-- License : BSD-style (see the file LICENSE)
--
-- Maintainer : Edward Kmett <ekmett@gmail.com>
-- Stability : experimental
-- Portability : non-portable
--
-- Common... | phaazon/linear | src/Linear/Projection.hs | Haskell | bsd-3-clause | 5,852 |
module DepthFirstSearchTest where
import qualified DepthFirstSearch as DFS
import qualified Data.Set as Set
import Test.Hspec
import Test.QuickCheck
import Debug.Trace
makeGraph :: DFS.Graph
makeGraph = DFS.AdjList [ [1, 2] -- 0
, [0, 3] -- 1
, [0] -- 2
, [1, 4] ... | ashishnegi/hsalgos | test/DepthFirstSearchTest.hs | Haskell | bsd-3-clause | 895 |
{-# LANGUAGE CPP, MagicHash, NondecreasingIndentation, UnboxedTuples #-}
-- -----------------------------------------------------------------------------
--
-- (c) The University of Glasgow, 2005-2007
--
-- Running statements interactively
--
-- -------------------------------------------------------------------------... | alexander-at-github/eta | compiler/ETA/Main/InteractiveEval.hs | Haskell | bsd-3-clause | 42,109 |
{-# LANGUAGE CPP, BangPatterns #-}
--------------------------------------------------------------------------------
-- |
-- Module : GalFld.Algorithmen.Berlekamp
-- Note : Implementiert eine Berlekamp Faktorisierung
--
-- Funktioniert nur auf Quadratfreien Polynomen
--
-- Enthält den 1967 von Elwyn Berlekam... | maximilianhuber/softwareProjekt | src/GalFld/Algorithmen/Berlekamp.hs | Haskell | bsd-3-clause | 7,557 |
{-# OPTIONS_HADDOCK hide #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Network.DHT.Kademlia.Workers.Persistence (persistRoutingTable) where
import Control.Concurrent
import Control.Concurrent.STM
import Control.Concurre... | phylake/kademlia | Network/DHT/Kademlia/Workers/Persistence.hs | Haskell | bsd-3-clause | 1,315 |
{-# LANGUAGE OverloadedStrings #-}
module Bot.Action.Maven
( maven
, version
, parentVersion
, changeDependencyVersion
, updateDependencyVersions
, properties
, snapshots
) where
import Bot.Action.Action
import Bot.Action.XML
import Bot.Types
import Bot.Util
import Control.Arrow
import Control.Monad
i... | andregr/bot | lib/Bot/Action/Maven.hs | Haskell | bsd-3-clause | 4,303 |
-- This afternoon
-- 1. How do we constrain fully crossed?
-- 2. Set up minimal example
-- a. Minimal block rewrite
-- b. Does it desugar correctly?
-- c. Write tests & update the error handling
-- 3. Deal with blocks for real
-- 4. Deal with exact constraint syntax/wording & wtf is going on with transitions
... | anniecherk/pyschocnf | notes/parser_interface/minimal.hs | Haskell | bsd-3-clause | 1,067 |
{-# LANGUAGE PatternSynonyms #-}
--------------------------------------------------------------------------------
-- |
-- Module : Graphics.GL.AMD.FramebufferSamplePositions
-- Copyright : (c) Sven Panne 2019
-- License : BSD3
--
-- Maintainer : Sven Panne <svenpanne@gmail.com>
-- Stability : stable
... | haskell-opengl/OpenGLRaw | src/Graphics/GL/AMD/FramebufferSamplePositions.hs | Haskell | bsd-3-clause | 1,028 |
{-# LANGUAGE TypeOperators #-}
{-# Language RebindableSyntax #-}
{-# Language ScopedTypeVariables #-}
{-# Language FlexibleContexts #-}
module Main where
import Prelude hiding ((>>=), (>>), fail, return, id, print, mod)
import Symmetry.Language
import Symmetry.Verify
import Symmetry.SymbEx
import SrcHelper
type Msg ... | abakst/symmetry | checker/tests/todo/SrcSieve.hs | Haskell | mit | 4,162 |
module SymBoilerPlate where
{-@ nonDet :: a -> x:Int -> {v:Int | 0 <= v && v < x } @-}
nonDet :: a -> Int -> Int
nonDet = undefined
{-@ nonDetRange :: x:Int -> y:Int -> {v:Int | x <= v && v < y} @-}
nonDetRange :: Int -> Int -> Int
nonDetRange = undefined
{-@
data Val p = VUnit {}
| VUnInit {}
... | abakst/symmetry | checker/include/SymBoilerPlate.hs | Haskell | mit | 1,749 |
{-# LANGUAGE GADTs, PolyKinds, RankNTypes #-}
module GADTVars where
import Data.Kind
import Data.Proxy
data T (k1 :: Type) (k2 :: Type) (a :: k2) (b :: k2) where
MkT :: T x1 Type (Proxy (y :: x1), z) z
| sdiehl/ghc | testsuite/tests/dependent/should_compile/mkGADTVars.hs | Haskell | bsd-3-clause | 207 |
module MyHttp (RequestType (..), Request(..), Response(..), Context(..), ServerPart) where
data RequestType = Get | Post
data Request = Request
{ route :: String
, reqtype :: RequestType
}
data Response = Response
{ content :: String
, statusCode :: Int
}
instance Show Response where
show (Re... | nicolocodev/learnhappstack | 3_Composition/MyHttp.hs | Haskell | mit | 527 |
{-
(c) The AQUA Project, Glasgow University, 1993-1998
\section{Common subexpression}
-}
{-# LANGUAGE CPP #-}
module ETA.SimplCore.CSE (cseProgram) where
#include "HsVersions.h"
import ETA.Core.CoreSubst
import ETA.BasicTypes.Var ( Var )
import ETA.BasicTypes.Id ( Id, idType, idInlineAct... | alexander-at-github/eta | compiler/ETA/SimplCore/CSE.hs | Haskell | bsd-3-clause | 12,560 |
{-
Copyright (C) 2009 John Goerzen <jgoerzen@complete.org>
All rights reserved.
For license and copyright information, see the file COPYRIGHT
-}
module TestInfrastructure where
import qualified Test.QuickCheck as QC
import qualified Test.HUnit as HU
import Test.HUnit.Tools
q :: QC.Testable a => String -> a -> HU.Tes... | cabrera/hdbc | testsrc/TestInfrastructure.hs | Haskell | bsd-3-clause | 410 |
{-# LANGUAGE OverloadedStrings #-}
module OperationalTests where
import Type
import Operational
base_send1 :: Test
base_send1 = Test "Base" "send1" [
Transactional [NewStream StringT "s_"] [(StreamSinkT StringT, "s_", s)],
NewList StringT out,
Transactional [Listen "l_" s (StringT, "a") [AppendList out (... | kevintvh/sodium | common-tests/OperationalTests.hs | Haskell | bsd-3-clause | 604 |
-------------------------------------------------------------------------------
-- |
-- Module : CCO.Tree
-- Copyright : (c) 2008 Utrecht University
-- License : All rights reserved
--
-- Maintainer : stefan@cs.uu.nl
-- Stability : provisional
-- Portability : portable
--
-- A straightforward implem... | UU-ComputerScience/uu-cco | uu-cco/src/CCO/Tree.hs | Haskell | bsd-3-clause | 1,078 |
{-# LANGUAGE CPP #-}
-----------------------------------------------------------------------------
-- |
-- Module : Distribution.Simple.GHC
-- Copyright : Isaac Jones 2003-2007
-- License : BSD3
--
-- Maintainer : cabal-devel@haskell.org
-- Portability : portable
--
-- This is a fairly large module. It... | thoughtpolice/cabal | Cabal/Distribution/Simple/GHC.hs | Haskell | bsd-3-clause | 52,313 |
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
module Utils.Http (send) where
import qualified Control.Exception as E
import Control.Monad.Error.Class (MonadError, throwError)
import Control.Monad.Trans (MonadIO, liftIO)
import qualified Data.ByteString.Char8 as BSC
import qualified Data.List as ... | laszlopandy/elm-package | src/Utils/Http.hs | Haskell | bsd-3-clause | 1,824 |
{-# LANGUAGE RecursiveDo, RankNTypes, NamedFieldPuns, RecordWildCards #-}
module Distribution.Server.Features.Upload (
UploadFeature(..),
UploadResource(..),
initUploadFeature,
UploadResult(..),
) where
import Distribution.Server.Framework
import Distribution.Server.Framework.BackupDump
import Distr... | ocharles/hackage-server | Distribution/Server/Features/Upload.hs | Haskell | bsd-3-clause | 19,842 |
<?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="hi-IN">
<title>Passive Scan Rules - Beta | ZAP Extension</title>
<maps>
<homeID>top</homeID>... | thc202/zap-extensions | addOns/pscanrulesBeta/src/main/javahelp/org/zaproxy/zap/extension/pscanrulesBeta/resources/help_hi_IN/helpset_hi_IN.hs | Haskell | apache-2.0 | 986 |
{-
(c) The University of Glasgow 2006
(c) The GRASP Project, Glasgow University, 1992-2000
Defines basic functions for printing error messages.
It's hard to put these functions anywhere else without causing
some unnecessary loops in the module dependency graph.
-}
{-# LANGUAGE CPP, DeriveDataTypeable, ScopedTypeVari... | ml9951/ghc | compiler/utils/Panic.hs | Haskell | bsd-3-clause | 9,492 |
{-# OPTIONS -fglasgow-exts #-}
-- Tests the "stupid theta" in pattern-matching
-- when there's an existential as well
module ShouldCompile where
data (Show a) => Obs a = forall b. LiftObs a b
f :: Show a => Obs a -> String
f (LiftObs _ _) = "yes"
| hvr/jhc | regress/tests/1_typecheck/2_pass/ghc/tc182.hs | Haskell | mit | 271 |
module LayoutLet2 where
-- Simple let expression, rename xxx to something longer or shorter
-- and the let/in layout should adjust accordingly
-- In this case the tokens for xxx + a + b should also shift out
foo xxx = let a = 1
b = 2 in xxx + a + b
| mpickering/ghc-exactprint | tests/examples/transform/LayoutLet2.hs | Haskell | bsd-3-clause | 266 |
-- In this example, adding 'main' to the export will fail as it is already exported.
module A1 where
import D1
import C1
import B1
main :: Tree Int ->Bool
main t = isSame (sumSquares (fringe t))
(sumSquares (B1.myFringe t)+sumSquares (C1.myFringe t))
| SAdams601/HaRe | old/testing/fromConcreteToAbstract/A1_TokOut.hs | Haskell | bsd-3-clause | 285 |
{-# LANGUAGE MagicHash #-}
module Foo where
foo# = 'a'
| urbanslug/ghc | testsuite/tests/parser/should_compile/read047.hs | Haskell | bsd-3-clause | 59 |
module Annfail01 where
-- Testing annotating things that don't exist
{-# ANN type Foo (1 :: Int) #-}
{-# ANN f (1 :: Int) #-} | urbanslug/ghc | testsuite/tests/annotations/should_fail/annfail01.hs | Haskell | bsd-3-clause | 126 |
module Chapter8.Syntax.Number where
import Data.Monoid
import Data.Display
import Chapter8.Syntax.Type
data NumVal
= NumZero
| NumSucc NumVal
deriving (Eq, Show)
toRealNum :: NumVal -> Integer
toRealNum = walk 0
where
walk c nv = case nv of
NumZero -> c
NumSucc v -> walk (c + 1) v
instance Ord ... | VoQn/tapl-hs | src/Chapter8/Syntax/Number.hs | Haskell | mit | 1,016 |
{-# LANGUAGE DeriveDataTypeable #-}
module CodeAdapter where
import Control.Monad.IfElse
import SoOSiM
import Code
import Node
data TransfomerState = TransfomerState
data CodeAdapterMsg = Compile BlockCode Architecture
deriving (Typeable)
instance ComponentIface TransfomerState where
initState = Transf... | christiaanb/SoOSiM | examples/Twente/CodeAdapter.hs | Haskell | mit | 597 |
{-# LANGUAGE OverloadedStrings #-}
-----------------------------------------------------------------------------
--
-- Module : DataAssociation.Explore.UI.Web.Server
-- Copyright :
-- License : MIT
--
-- Maintainer : -
-- Stability :
-- Portability :
--
-- |
--
---------------------------------------... | fehu/min-dat--a-priori | explore-web-backend/src/DataAssociation/Explore/UI/Web/Server.hs | Haskell | mit | 1,484 |
{-# LANGUAGE TypeOperators, OverloadedStrings #-}
module Cypher.Actions where
import Cypher.Types
import Cypher.Utils
import Data.Monoid
import Control.Monad.Free
import Data.Text as T
commitTransaction :: Neo4jRequest ~> TransactionResponse
commitTransactio... | 5outh/cypher | src/Cypher/Actions.hs | Haskell | mit | 2,943 |
import Utils
import qualified Data.Set as S
import Control.Monad.State
import Debug.Trace
import Data.List (foldl')
nmax = 1000000
sumSquareDigit :: Int -> Int
--sumSquareDigit n = sum $ map (^2) $ numberToDigitsBackwards n
sumSquareDigit n | n<10 = n^2
| otherwise = (n `mod` 10)^2 + sumSquareDigit (... | arekfu/project_euler | p0092/p0092.hs | Haskell | mit | 1,704 |
module Import
( module Import
) where
import Prelude as Import hiding (head, init, last,
readFile, tail, writeFile)
import Yesod as Import hiding (Route (..))
import Yesod.Static as Import
import ... | collaborare/antikythera | src/Import.hs | Haskell | mit | 1,088 |
{-# LANGUAGE PatternSynonyms, ForeignFunctionInterface, JavaScriptFFI #-}
module GHCJS.DOM.JSFFI.Generated.SVGAnimatedEnumeration
(js_setBaseVal, setBaseVal, js_getBaseVal, getBaseVal,
js_getAnimVal, getAnimVal, SVGAnimatedEnumeration,
castToSVGAnimatedEnumeration, gTypeSVGAnimatedEnumeration)
... | manyoo/ghcjs-dom | ghcjs-dom-jsffi/src/GHCJS/DOM/JSFFI/Generated/SVGAnimatedEnumeration.hs | Haskell | mit | 2,196 |
module Clavier.SortingAlgorithms (selection_sort, insertion_sort, merge_sort, quick_sort) where
import Data.List
selection_sort :: (Ord a) => [a] -> [a]
selection_sort (x : [])
= [x]
selection_sort []
= []
selection_sort li
= let
select_min min [] prev = (min, prev)
select_min min (x:xs) prev
| x < min = sel... | Raekye/The-Modern-Clavier | haskell/src/Clavier/SortingAlgorithms.hs | Haskell | mit | 1,877 |
module HaskellRead where
import File
import System.FilePath.Posix (takeExtension)
import Text.Regex.Posix
import Util
isSupportedFilePath :: FilePath -> Bool
isSupportedFilePath = (==) ".hs" . takeExtension
isSupportedFile :: File -> Bool
isSupportedFile file =
(extension ... | larioj/nemo | src/HaskellRead.hs | Haskell | mit | 1,076 |
-- | Exercises for Chapter 6.
--
-- Implement the functions in this module using recursion.
module Chapter06 (and, concat, replicate, elem, (!!), merge, msort) where
import Prelude hiding (and, concat, elem, replicate, (!!))
-- * Exercise 1
-- | Decide if all logical values in a list are true.
and :: [Boo... | EindhovenHaskellMeetup/meetup | courses/programming-in-haskell/pih-exercises/src/Chapter06.hs | Haskell | mit | 1,126 |
module DecryptEnvironment () where
import Text.Read(readMaybe)
import Global(Error, Arg, Rounds, KeyFilename)
type DecryptEnv = () -- TODO
| tombusby/haskell-des | round/DecryptEnvironment.hs | Haskell | mit | 142 |
-- There might be a clever way to work out the digits on paper
-- by counting the number sizes, but this is faster.
import Data.Char (ord)
digitToInt d = (ord d) - (ord '0')
frac = concat $ map show [0..]
digits = map (\i -> digitToInt $ frac !! (10^i)) [0..6]
answer = product digits
main = print answer | gumgl/project-euler | 40/40.hs | Haskell | mit | 310 |
module Data.Set.Data where
import qualified Data.Set as Set
setTo :: Int -> Set.Set Int
setTo n = Set.fromList [1..n]
set1 :: Set.Set Int
set1 = setTo 10
set2 :: Set.Set Int
set2 = setTo 20
set3 :: Set.Set Int
set3 = setTo 30
set4 :: Set.Set Int
set4 = setTo 40
set5 :: Set.Set Int
set5 = setTo 50
| athanclark/sets | bench/Data/Set/Data.hs | Haskell | mit | 307 |
{-# LANGUAGE BangPatterns #-}
module Main where
import System.Random (randomRIO)
import Control.Monad (replicateM)
import Debug.Trace
-- | Perceptron implementation in Haskell (dirty)
--
type Input = [Double]
type Data = [(Input, Double)]
type Weights = [Double]
type Rate = Double -- [0,1]
round'... | cirquit/Personal-Repository | Haskell/machine-learning/perceptron/perceptron.hs | Haskell | mit | 3,511 |
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Parse
import System.Environment
main = do
f <- readFile "prog.txt"
args <- getArgs
let command = if length args > 0 then prog else finish prog
case runParser command f of
xs -> do
mapM_ print $ take 5 xs
print $ length xs
| kovach/cards | src/Main.hs | Haskell | mit | 310 |
{-# Language TemplateHaskell #-}
module Main where
-- base
import Data.Monoid
import Control.Applicative
-- linear
import Linear
-- lens
import Control.Lens
-- gloss
import Graphics.Gloss
import Graphics.Gloss.Interface.Pure.Game
-- colour
import Data.Colour (Colour)
import Data.Colour.RGBSpace
import Data.Colour.RGBSp... | startling/falling | main.hs | Haskell | mit | 3,241 |
-- -------------------------------------------------------------------------------------
-- Author: Sourabh S Joshi (cbrghostrider); Copyright - All rights reserved.
-- For email, run on linux (perl v5.8.5):
-- perl -e 'print pack "H*","736f75726162682e732e6a6f73686940676d61696c2e636f6d0... | cbrghostrider/Hacking | HackerRank/FunctionalProgramming/Recursion/sierpinskiTriangleFractals.hs | Haskell | mit | 3,648 |
module Main where
import Tokenizer
import Types
import Grammar
import FP_ParserGen -- Touching this file leaves you at your own devices
import ASTBuilder
import Checker
import CodeGen
-- import Simulation
import System.FilePath
import Sprockell
main :: IO()
main = do
putStrLn "What file do you want to run... | wouwouwou/2017_module_8 | src/haskell/PP-project-2017/Main.hs | Haskell | apache-2.0 | 897 |
{-# language DataKinds #-}
{-# language FlexibleContexts #-}
{-# language PartialTypeSignatures #-}
{-# language OverloadedLabels #-}
{-# language OverloadedStrings #-}
{-# language TypeApplications #-}
{-# OPTIONS_GHC -fno-warn-partial-type-signatures #-}
module Main where
import ... | frees-io/freestyle-rpc | modules/haskell-integration-tests/mu-haskell-client-server/protobuf-server/Main.hs | Haskell | apache-2.0 | 2,250 |
module Coins.A263135Spec (main, spec) where
import Test.Hspec
import Coins.A263135 (a263135)
main :: IO ()
main = hspec spec
spec :: Spec
spec = describe "A263135" $
it "correctly computes the first 20 elements" $
map a263135 [0..20] `shouldBe` expectedValue where
expectedValue = [0,0,1,2,3,4,6,7,8,9,... | peterokagey/haskellOEIS | test/Coins/A263135Spec.hs | Haskell | apache-2.0 | 354 |
-- Copyright 2012-2014 Samplecount S.L.
--
-- Licensed 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
--
-- Unless required by applicable law or agr... | samplecount/shake-language-c | src/Development/Shake/Language/C/Host/Linux.hs | Haskell | apache-2.0 | 1,375 |
module Sol1 where
import GS
-- 1.9
maxInt :: [Int] -> Int
maxInt [] = error "empty list"
maxInt [x] = x
maxInt (x:xs) = max x (maxInt xs)
-- 1.10
removeFst :: [Int] -> Int -> [Int]
removeFst [] y = []
removeFst (x:xs) y | x == y = xs
| otherwise = x:remo... | bartolkaruza/software-testing-2014-group-W1 | week1/week_1_group_w1/Sol1.hs | Haskell | apache-2.0 | 1,655 |
{-# OPTIONS -fglasgow-exts #-}
-----------------------------------------------------------------------------
{-| Module : QGLFramebufferObject.hs
Copyright : (c) David Harley 2010
Project : qtHaskell
Version : 1.1.4
Modified : 2010-09-02 17:02:36
Warning : this file is machine generat... | keera-studios/hsQt | Qtc/Enums/Opengl/QGLFramebufferObject.hs | Haskell | bsd-2-clause | 2,489 |
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveGeneric #-}
-----------------------------------------------------------------------------
-- |
-- Module : Distribution.Simple.Setup
-- Copyright : Isaac Jones 2003-2004
-- Duncan Coutts 2007
-- License : BSD3
--
-- Maintainer : cabal-devel@haskell... | sopvop/cabal | Cabal/Distribution/Simple/Setup.hs | Haskell | bsd-3-clause | 86,958 |
{-# LANGUAGE OverloadedStrings, FlexibleContexts #-}
module Aws.SimpleDb.Model
where
import Aws.SimpleDb.Response
import Aws.Util
import Aws.Xml
import Control.Monad
import Text.XML.Cursor (($/), (&|))
import qualified Control.Failure as F
import ... | jgm/aws | Aws/SimpleDb/Model.hs | Haskell | bsd-3-clause | 3,217 |
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE TupleSections #-}
module Bertrand.Parser
(parse
)where
import Prelude hiding (null)
import Control.Applicative
import Control.Monad
-- import Control.Monad.Trans.Maybe
-- import Control.Monad.State
import Data.Char
import qualified Data.Map as M
import Data.Maybe
-- i... | fujiy00/bertrand | src/Bertrand/Parser.hs | Haskell | bsd-3-clause | 11,294 |
module Generate.Functions where
import Data.Char
import Data.Maybe
import Control.Applicative
import Control.Exception(assert)
import Data.XCB
import HaskellCombinators
import Generate(valueParamName,mapAlt,xImport,mapIdents,fieldName,fieldType)
import Generate.Monad
import Generate.Facts
import Generate.Util
imp... | aslatter/xhb | build-utils/src/Generate/Functions.hs | Haskell | bsd-3-clause | 13,073 |
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE MultiWayIf #-}
module Game.Monsters.MTank where
import Control.Lens (use, preuse, ix, zoom, (^.), (.=), (%=), (&), (.~), (%~))
import Control.Monad (void, when, unless, liftM)
import Data.Bits ((.&.), (.|.), complement)
import Linear (V3(..), normalize)
import qualified ... | ksaveljev/hake-2 | src/Game/Monsters/MTank.hs | Haskell | bsd-3-clause | 32,835 |
{-
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998
\section[PatSyntax]{Abstract Haskell syntax---patterns}
-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE StandaloneDerivi... | mettekou/ghc | compiler/hsSyn/HsPat.hs | Haskell | bsd-3-clause | 29,415 |
module CNC.GParser(module CNC.GTypes, parseIsoFile) where
import CNC.GTypes
import Data.Attoparsec.Text
import qualified Data.Text as T
import qualified Data.Text.Lazy as T
import qualified Data.Text.Lazy.IO as T
import Data.Char
import Control.Applicative
import Data.Maybe
instrP = do
c <- toUpper <$> letter
va... | akamaus/gcodec | src/CNC/GParser.hs | Haskell | bsd-3-clause | 1,681 |
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUA... | GaloisInc/stack | src/Stack/Config.hs | Haskell | bsd-3-clause | 20,212 |
{-# LANGUAGE OverloadedStrings #-}
module Main where
import GHC.IO.Exception (ExitCode(..))
import System.Exit (die)
import Data.Monoid ((<>))
import Control.Applicative (empty)
import Data.Aeson
import Turtle.Prelude (procStrictWithErr, shell)
import qualified Data.ByteString.Lazy as BS
import System.Directory (getA... | alexander-at-github/eta | tests/packages/Test.hs | Haskell | bsd-3-clause | 1,599 |
-----------------------------------------------------------------------------
-- |
-- Module : Distribution.Client.Init.Heuristics
-- Copyright : (c) Benedikt Huber 2009
-- License : BSD-like
--
-- Maintainer : cabal-devel@haskell.org
-- Stability : provisional
-- Portability : portable
--
-- Heuris... | plumlife/cabal | cabal-install/Distribution/Client/Init/Heuristics.hs | Haskell | bsd-3-clause | 14,315 |
{-# LANGUAGE DeriveGeneric #-}
module Competition where
import Data.Aeson
import GHC.Generics
data Competition = Competition
{ id :: Int
, caption :: String
, league :: String
, year :: String
, currentMatchday :: Int
, numberOfMatchdays :: Int
, numberOfTeams :: Int
, numberOfGames :: Int
, lastUp... | julienXX/football-data-client | src/Competition.hs | Haskell | bsd-3-clause | 658 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.