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 |
|---|---|---|---|---|---|
module LogicCode
( HuffmanNode,
truthTable,
grayCode,
huffmanCode
) where
data HuffmanNode a = Empty | Leaf (a, Int) | Branch Int (HuffmanNode a) (HuffmanNode a)
--Problem 46 - 49: Problem 48: Truth tables for logical expressions.
--Eg: truthTable 3 (\[a, b, c] -> Logical expr involving a, b, and c)
truthTable... | 5hubh4m/99-haskell-problems | LogicCode.hs | Haskell | mit | 2,437 |
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE CPP #-}
module Data.Bson.Types
( RegexOption(..)
, RegexOptions
, Value(..)
, Binary(..)
, ObjectId(..)
, Document
, Array
, Label
, Field
) where
import Data.Int (Int32, Int64)
import Data.Time.Clock (UTCTime)
import Data.Time.F... | lambda-llama/bresson | src/Data/Bson/Types.hs | Haskell | mit | 2,635 |
module Graphics.Urho3D.UI.Internal.Sprite(
Sprite
, spriteCntx
, sharedSpritePtrCntx
, SharedSprite
) where
import qualified Language.C.Inline as C
import qualified Language.C.Inline.Context as C
import qualified Language.C.Types as C
import Graphics.Urho3D.Container.Ptr
import qualified Data.Map as Map
... | Teaspot-Studio/Urho3D-Haskell | src/Graphics/Urho3D/UI/Internal/Sprite.hs | Haskell | mit | 494 |
-- Examples from chapter 8
-- http://learnyouahaskell.com/making-our-own-types-and-typeclasses
import qualified Data.Map as Map
data Point = Point Float Float deriving (Show)
data Shape = Circle Point Float | Rectangle Point Point deriving (Show)
surface :: Shape -> Float
surface (Circle _ r) = pi * r ^ 2
surface (Re... | Sgoettschkes/learning | haskell/LearnYouAHaskell/08.hs | Haskell | mit | 3,046 |
{-|
Module: Flaw.UI.ScrollBox
Description: Scroll box.
License: MIT
-}
module Flaw.UI.ScrollBox
( ScrollBox(..)
, newScrollBox
, ScrollBar(..)
, newScrollBar
, newVerticalScrollBar
, newHorizontalScrollBar
, processScrollBarEvent
, ensureVisibleScrollBoxArea
) where
import Control.Concurrent.STM
imp... | quyse/flaw | flaw-ui/Flaw/UI/ScrollBox.hs | Haskell | mit | 10,754 |
module Diamond (diamond) where
diamond :: Char -> Maybe [String]
diamond = error "You need to implement this function"
| exercism/xhaskell | exercises/practice/diamond/src/Diamond.hs | Haskell | mit | 120 |
import Control.Monad
main = print . msum $ do
x <- [ 1 .. 1000 ]
y <- [x + 1 .. div (1000 - x) 2 ]
let z = 1000 - x - y
return $ if x^2 + y^2 == z^2 && x + y + z == 1000
then Just $ x * y * z
else Nothing
| nickspinale/euler | complete/009.hs | Haskell | mit | 253 |
module BFLib.BrainfuchFollow where
import Control.Monad.State
import Control.Monad.Writer
import System.IO
import BFLib.Brainfuch (Code
, Stack
, bfTail
, emptyStack
, incPtr
, decPtr
, incCell
, decCell
, bfGetLoop
, bfDropLoop)
{-
- Syntax
... | dermesser/Brainfuch | BFLib/BrainfuchFollow.hs | Haskell | mit | 2,592 |
module PartialRecordSel where
-- Partial record selectors use 'error' in the output (which is undefined)
-- Would be better to use 'panic' (or be able to skip them entirely).
data R = R1 { a :: Bool } | R2 { b :: Bool }
| antalsz/hs-to-coq | examples/base-tests/PartialRecordSel.hs | Haskell | mit | 222 |
module Examples.EX3 where
import Control.Lens
import Control.Lens.Setter
import Control.Monad (void)
import Control.Monad.Trans.Class (lift)
import Data.List (intersperse, isPrefixOf)
import Data.Time.LocalTime
import Data.Maybe (catMaybes)
import Twilio.Key
import Twilio.IVR
data User = User {
lastname :: Stri... | steven777400/TwilioIVR | src/Examples/EX3.hs | Haskell | mit | 1,669 |
{-# OPTIONS_GHC -Wall #-}
module LogAnalysis where
import Log
import Data.Char (isDigit)
parseMessage :: String -> LogMessage
parseMessage (x:' ':xs)
| x == 'I' = LogMessage Info first body
| x == 'W' = LogMessage Warning first body
| x == 'E' = LogMessage (Error first) second (trim body)
where body ... | tylerjl/cis194 | old/hw02/LogAnalysis.hs | Haskell | mit | 1,674 |
{-# OPTIONS -fglasgow-exts #-}
-----------------------------------------------------------------------------
{-| Module : QNetworkInterface.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 ... | keera-studios/hsQt | Qtc/Enums/Network/QNetworkInterface.hs | Haskell | bsd-2-clause | 4,834 |
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
module Acid (loadSet, addExperiment) where
import Control.Monad.Reader
import Control.Monad.State
import Data.Acid
import Data.SafeCopy
import Data.Time.LocalTime (ZonedTime(..))
import Data.Typeable
import qualified D... | carlohamalainen/imagetrove-cai-projects-db | Acid.hs | Haskell | bsd-2-clause | 2,332 |
{-# LANGUAGE CPP, FlexibleContexts, GeneralizedNewtypeDeriving, InstanceSigs,
RankNTypes, ScopedTypeVariables, TypeFamilies, UndecidableInstances #-}
module Text.Grampa.ContextFree.Memoizing
{-# DEPRECATED "Use Text.Grampa.ContextFree.SortedMemoizing instead" #-}
(ResultList(..), Parser(..), ... | blamario/grampa | grammatical-parsers/src/Text/Grampa/ContextFree/Memoizing.hs | Haskell | bsd-2-clause | 18,417 |
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module ApiTypes where
import Control.Applicative (Applicative)
import Control.Concurrent.STM (TVar)
import Control.Monad.Reader (MonadReader, ReaderT (..))
import Control.Monad.Trans (MonadIO)
import Data.HashMap.Strict (HashMap)
import Data.Set (Set)
import Type.Comment (C... | tinkerthaler/basic-invoice-rest | example-api/ApiTypes.hs | Haskell | bsd-3-clause | 914 |
{-|
Module : MixedTypesNumPrelude
Description : Bottom-up typed numeric expressions
Copyright : (c) Michal Konecny, Pieter Collins
License : BSD3
Maintainer : mikkonecny@gmail.com
Stability : experimental
Portability : portable
@MixedTypesNumPrelude@ provides a ver... | michalkonecny/mixed-types-num | src/MixedTypesNumPrelude.hs | Haskell | bsd-3-clause | 2,375 |
module Signal.Wavelet.Eval2Bench where
import Signal.Wavelet.Eval2
{-# INLINE benchDwt #-}
benchDwt :: ([Double], [Double]) -> [Double]
benchDwt (ls, sig) = dwt ls sig
{-# INLINE benchIdwt #-}
benchIdwt :: ([Double], [Double]) -> [Double]
benchIdwt (ls, sig) = idwt ls sig
| jstolarek/lattice-structure-hs | bench/Signal/Wavelet/Eval2Bench.hs | Haskell | bsd-3-clause | 278 |
{-# LANGUAGE MultiParamTypeClasses, NoImplicitPrelude, RebindableSyntax #-}
{-# LANGUAGE ScopedTypeVariables, ViewPatterns #-}
module Numeric.Field.Fraction
( Fraction
, numerator
, denominator
, Ratio
, (%)
, lcm
) where
import Data.Proxy
import Numeric.Additive.Class
import Nume... | athanclark/algebra | src/Numeric/Field/Fraction.hs | Haskell | bsd-3-clause | 4,275 |
{-# LANGUAGE FlexibleContexts #-}
module Language.Typo.Token
( typoDef -- :: LanguageDef s
, typo -- :: GenTokenParser String u Identity
, lexeme -- :: Parsec String u a -> Parsec String u a
, parens -- :: Parsec String u a -> Parsec String u a
, identifier -- :: Parsec String u String
... | seliopou/typo | Language/Typo/Token.hs | Haskell | bsd-3-clause | 1,630 |
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE MultiParamTypeClas... | emwap/feldspar-language | src/Feldspar/Core/Constructs/MutableToPure.hs | Haskell | bsd-3-clause | 4,777 |
{-
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: 2.0
Kubernetes API version: v1.9.12
Generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
-}
{-|
Module : Kubernetes.OpenAPI.API.Certifi... | denibertovic/haskell | kubernetes/lib/Kubernetes/OpenAPI/API/Certificates.hs | Haskell | bsd-3-clause | 2,742 |
module Network.PushbulletSpec (main, spec) where
import Test.Hspec
main :: IO ()
main = hspec spec
spec :: Spec
spec = do
describe "someFunction" $ do
it "should work fine" $ do
True `shouldBe` False
| KevinCotrone/pushbullet | test/Network/PushbulletSpec.hs | Haskell | bsd-3-clause | 215 |
import System.Environment (getArgs)
import Data.List.Split (splitOn)
maxran :: Int -> Int -> [Int] -> [Int] -> Int
maxran x _ _ [] = x
maxran x c (y:ys) (z:zs) = maxran (max x d) d (ys ++ [z]) zs
where d = c - y + z
maxrange :: [String] -> Int
maxrange [ns, x... | nikai3d/ce-challenges | easy/max_range_sum.hs | Haskell | bsd-3-clause | 673 |
import System.Environment (getArgs)
r1 :: [Int]
r1 = [1, 0, 0, 0, 1, 1]
r2 :: [Int]
r2 = [1, 0, 1, 0, 1, 1]
bnot :: Int -> Int
bnot 0 = 1
bnot _ = 0
pmod6 :: Int -> Int
pmod6 x | mod x 6 == 0 = 6
| otherwise = mod x 6
locks :: [Int] -> Int
locks [0, _] = 0
locks [x, 0] = x
locks [x, 1] = x-1
locks [x, y... | nikai3d/ce-challenges | moderate/locks.hs | Haskell | bsd-3-clause | 816 |
module Main where
import Graphics.Gnuplot.Simple
-- import qualified Graphics.Gnuplot.Terminal.WXT as WXT
-- import qualified Graphics.Gnuplot.Terminal.PostScript as PS
ops :: [Attribute]
-- ops = [(Custom "term" ["postscript", "eps", "enhanced", "color", "solid"])
-- ,(Custom "output" ["temp.eps"])
-- ]... | chupaaaaaaan/nn-with-haskell | app/Main_ex.hs | Haskell | bsd-3-clause | 569 |
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Control.Monad.Trans (lift)
import qualified Data.Text as T
import Data.Either
import Reflex.Dom
import Frontend.Function
import Frontend.ImageWidget
import Frontend.WebcamWidget
main :: IO ()
main = mainWidget $ do
d <- lift askDocument
-- imageInputWid... | CBMM/CBaaS | cbaas-frontend/exec/Frontend.hs | Haskell | bsd-3-clause | 591 |
module Horbits.Body (bodyUiColor, getBody, fromBodyId, module X)
where
import Control.Lens hiding ((*~), _2, _3, _4)
import Horbits.Body.Atmosphere as X
import Horbits.Body.Body as X
import Horbits.Body.Color as X
import Horbits.Body.Data ... | chwthewke/horbits | src/horbits/Horbits/Body.hs | Haskell | bsd-3-clause | 790 |
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
-- | All types.
module HIndent.Types
(Printer(..)
,PrintState(..)
,Extender(..)
,Style(..)
,Config(..)
,defaultConfig
,NodeInfo(..)
,ComInf... | adamse/hindent | src/HIndent/Types.hs | Haskell | bsd-3-clause | 4,328 |
module Graphics.Vty.Widgets.Builder.SrcHelpers
( defAttr
, toAST
, call
, bind
, tBind
, noLoc
, act
, expr
, mkTyp
, parseType
, mkList
, parens
, mkName
, mkString
, mkInt
, mkChar
, mkTup
, opApp
, mkLet
, mkImportDecl
, nameStr
... | jtdaugherty/vty-ui-builder | src/Graphics/Vty/Widgets/Builder/SrcHelpers.hs | Haskell | bsd-3-clause | 3,680 |
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE CPP #-}
module Control.Distributed.Process.Serializable
( Serializable
, encodeFingerprint
, decodeFingerprint
, fingerprint
, sizeOfFingerprint
, Fingerpri... | mboes/distributed-process | src/Control/Distributed/Process/Serializable.hs | Haskell | bsd-3-clause | 2,835 |
module Utils (
wordCount,
makeBatch,
accuracy
) where
import Control.Arrow ( (&&&) )
import Data.List ( sort, group, reverse, nub )
import Control.Monad ( join )
wordCount :: (Eq a, Ord a) => [a] -> [(a, Int)]
wordCount = map (head &&& length) . group . sort
makeBatch :: Int -> [a] -> [[a]]
makeBatch _... | masashi-y/dynet.hs | examples/utils/Utils.hs | Haskell | bsd-3-clause | 653 |
module Data.Aeson.TH.Extra where
import Data.Aeson.TH
( defaultOptions
, Options(..)
)
import Data.String.Extra (dropL1)
prefixRemovedOpts :: Int -> Options
prefixRemovedOpts i = defaultOptions {fieldLabelModifier = dropL1 i}
| onurzdg/clicklac | src/Data/Aeson/TH/Extra.hs | Haskell | bsd-3-clause | 260 |
{-#LANGUAGE FlexibleInstances #-}
{-#LANGUAGE FlexibleContexts #-}
{-#LANGUAGE LambdaCase #-}
{-#LANGUAGE MultiParamTypeClasses #-}
{-#LANGUAGE OverloadedStrings #-}
{-#LANGUAGE Rank2Types #-}
{-#LANGUAGE ScopedTypeVariables #-}
module Twilio.Types
( APIVersion(..)
, module X
-- * Misc
, makeTwilioRequest
... | seagreen/twilio-haskell | src/Twilio/Types.hs | Haskell | bsd-3-clause | 2,543 |
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
-------------------------------------------------------------------------------
-- |
-- Module : Database.Bloodhound.Types.Internal
-- Copyrigh... | bermanjosh/bloodhound | src/Database/V5/Bloodhound/Types/Internal.hs | Haskell | bsd-3-clause | 2,168 |
{-
Problem 30
Numbers that can be written as powers of their digits
Result
443839
6.28 s
Comment
The upper boundary can be estimated since 999... = 10^k - 1 has to
be equal to 9^5 + 9^5 + ... = k 9^5, which yields the maximum
co... | quchen/HaskellEuler | src/Problem30.hs | Haskell | bsd-3-clause | 990 |
{-# LANGUAGE CPP #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE ScopedTypeVariables #-}
#ifdef DEFAULT_SIGNATURES
{-# LANGUAGE DefaultSignatures #-}
#endif
#if... | np/lens | src/Control/Lens/At.hs | Haskell | bsd-3-clause | 10,918 |
module Parser
()where
import Text.XML.HXT.Core
import Data.String.UTF8
import Control.Monad
odd :: (->) Int Bool
odd a = True
css tag = multi (hasName tag)
testDoc = do
html <- readFile "test.html"
let doc = readString [withParseHTML yes, withWarnings no] html
texts <- runX $ doc //> getText
mapM_ pu... | Numberartificial/workflow | snipets/src/Demo/Parser.hs | Haskell | mit | 525 |
{-# LANGUAGE CPP #-}
module Graphics.ImageMagick.MagickWand.PixelWand
( pixelWand
-- , clearPixelWand
-- , cloneWand
-- , cloneWands
, isPixelWandSimilar
-- , isPixelWand
, setColorCount, getColorCount
-- ** Literal names
, setColor
, getColorAsString, getColorAsNormalizedString
-- HSL
, get... | flowbox-public/imagemagick | Graphics/ImageMagick/MagickWand/PixelWand.hs | Haskell | apache-2.0 | 9,048 |
module Main where
import CLI.Main (runCLI)
import Data.Version (showVersion)
import Paths_gtfsschedule (version)
programHeader :: String
programHeader =
"gtfsschedule - Be on time for your next public transport service (v. " ++ showVersion version ++ ")"
main :: IO ()
main = runCLI programHeader "Shows schedule... | romanofski/gtfsbrisbane | app/Main.hs | Haskell | bsd-3-clause | 371 |
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE OverloadedStrings #-}
module Test.Foundation.String
( testStringRefs
) where
-- import Control.Monad (replicateM)
import Foundation
import Foundati... | vincenthz/hs-foundation | foundation/tests/Test/Foundation/String.hs | Haskell | bsd-3-clause | 8,790 |
{-# LANGUAGE OverloadedStrings #-}
module Web.Server
( runServer
, formalizerApp -- Exposed for testing.
) where
import Network.Wai.Middleware.RequestLogger
import Network.Wai.Middleware.Static
import Web.Actions as Action
import Web.Spock.S... | Lepovirta/Crystallize | app/Web/Server.hs | Haskell | bsd-3-clause | 1,172 |
{-
(c) The University of Glasgow 2006
(c) The AQUA Project, Glasgow University, 1998
This module contains definitions for the IdInfo for things that
have a standard form, namely:
- data constructors
- record selectors
- method and superclass selectors
- primitive operations
-}
{-# LANGUAGE CPP #-}
module MkId (
... | vTurbine/ghc | compiler/basicTypes/MkId.hs | Haskell | bsd-3-clause | 59,709 |
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-| Unittests for ganeti-htools.
-}
{-
Copyright (C) 2009, 2010, 2011, 2012, 2013 Google Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following condit... | leshchevds/ganeti | test/hs/Test/Ganeti/HTools/Instance.hs | Haskell | bsd-2-clause | 9,291 |
module Compiler.Simplify where
import Data.Generics.PlateData
import Compiler.Type
import Data.List
import Data.Maybe
simplify :: Program1 -> Program2
simplify = addDollar . reform . freezeRules
-- change rule application rule(arg) to rule_arg and replace all bits
freezeRules :: Program1 -> Program1
freezeRules xs... | silkapp/tagsoup | dead/parser/Compiler/old/Simplify.hs | Haskell | bsd-3-clause | 2,095 |
-- ----------------------------------------------------------------------------
-- | Handle conversion of CmmData to LLVM code.
--
module LlvmCodeGen.Data (
genLlvmData, resolveLlvmDatas, resolveLlvmData
) where
#include "HsVersions.h"
import Llvm
import LlvmCodeGen.Base
import BlockId
import CLabel
imp... | nomeata/ghc | compiler/llvmGen/LlvmCodeGen/Data.hs | Haskell | bsd-3-clause | 6,479 |
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Blackbox.Tests
( tests
, remove
, removeDir
) where
------------------------------------------------------------------------------
import Control.Exception (catch, finally, throwIO)
import Control... | sopvop/snap | test/suite/Blackbox/Tests.hs | Haskell | bsd-3-clause | 12,605 |
{-# LANGUAGE DataKinds, PolyKinds, TypeOperators, TypeFamilies
, TypeApplications, TypeInType #-}
module DumpParsedAst where
import Data.Kind
data Peano = Zero | Succ Peano
type family Length (as :: [k]) :: Peano where
Length (a : as) = Succ (Length as)
Length '[] = Zero
-- vis kind app
data T... | sdiehl/ghc | testsuite/tests/parser/should_compile/DumpParsedAst.hs | Haskell | bsd-3-clause | 456 |
module HLint.Generalise where
import Data.Monoid
import Control.Monad
warn = concatMap ==> (=<<)
warn = liftM ==> fmap
warn = map ==> fmap
warn = a ++ b ==> a `Data.Monoid.mappend` b
| bergmark/hlint | data/Generalise.hs | Haskell | bsd-3-clause | 186 |
module Type where
newtype TVar = TV String
deriving (Show, Eq, Ord)
data Type
= TVar TVar
| TCon String
| TArr Type Type
deriving (Show, Eq, Ord)
infixr `TArr`
data Scheme = Forall [TVar] Type
deriving (Show, Eq, Ord)
typeInt :: Type
typeInt = TCon "Int"
typeBool :: Type
typeBool = TCon "Bool"
| yupferris/write-you-a-haskell | chapter7/poly/src/Type.hs | Haskell | mit | 314 |
<?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="az-AZ">
<title>Passive Scan Rules - Alpha | ZAP Extension</title>
<maps>
<homeID>top</homeID... | kingthorin/zap-extensions | addOns/pscanrulesAlpha/src/main/javahelp/org/zaproxy/zap/extension/pscanrulesAlpha/resources/help_az_AZ/helpset_az_AZ.hs | Haskell | apache-2.0 | 988 |
module A1 where
import D1 (sumSquares, fringe)
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/mkImpExplicit/A1_AstOut.hs | Haskell | bsd-3-clause | 234 |
-- | Register coalescing.
module RegAlloc.Graph.Coalesce (
regCoalesce,
slurpJoinMovs
) where
import GhcPrelude
import RegAlloc.Liveness
import Instruction
import Reg
import Cmm
import Bag
import Digraph
import UniqFM
import UniqSet
import UniqSupply
import Data.List
-- | Do register coalescing on ... | ezyang/ghc | compiler/nativeGen/RegAlloc/Graph/Coalesce.hs | Haskell | bsd-3-clause | 2,760 |
module Existential where
-- Hmm, this is universal quantification, not existential.
data U = U (forall a . (a,a->Int,Int->a,a->a->a))
-- This is existential quantification
data E = forall a . {-Eq a =>-} E (a,a->Int,Int->a,a->a->a)
e = E (1,id,id,(+))
-- OK:
f (E (x,toint,fromint,op)) = toint (x `op` x)
-- Error: ... | forste/haReFork | tools/base/tests/Existential.hs | Haskell | bsd-3-clause | 682 |
-----------------------------------------------------------------------------
-- |
-- Module : Distribution.Simple.Program.Builtin
-- Copyright : Isaac Jones 2006, Duncan Coutts 2007-2009
--
-- Maintainer : cabal-devel@haskell.org
-- Portability : portable
--
-- The module defines all the known built-in 'Pr... | tolysz/prepare-ghcjs | spec-lts8/cabal/Cabal/Distribution/Simple/Program/Builtin.hs | Haskell | bsd-3-clause | 10,350 |
module T7848 where
data A = (:&&) Int Int | A Int Int
x (+) ((&)@z) ((:&&) a b) (c :&& d) (e `A` f) (A g h) = y
where infixl 3 `y`
y _ = (&)
{-# INLINE (&) #-}
{-# SPECIALIZE (&) :: a #-}
(&) = x
| gridaphobe/ghc | testsuite/tests/parser/should_fail/T7848.hs | Haskell | bsd-3-clause | 233 |
module Test.Scher.Property
( forAll
, Property (verify)
)
where
import Test.Scher.Generic
import Test.Scher.Symbolic
import System.IO.Unsafe
import System.Random
import Data.IORef
class Property b where
verify :: b -> IO ()
instance Property Bool where
verify b = assert b
forAll :: (Symbolic a, Property... | m-alvarez/scher | Test/Scher/Property.hs | Haskell | mit | 858 |
{-# LANGUAGE OverloadedStrings, TemplateHaskell #-}
module Web.Mackerel.Types.Host where
import Control.Applicative ((<|>))
import Data.Aeson
import qualified Data.Aeson as Aeson
import Data.Aeson.TH (deriveJSON, constructorTagModifier, fieldLabelModifier)
import Data.Aeson.Types (Parser, typeMismatch)
import Data.Cha... | itchyny/mackerel-client-hs | src/Web/Mackerel/Types/Host.hs | Haskell | mit | 5,116 |
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
module Game where
import Data.Monoid ((<>))
import Control.Concurrent (MVar, newEmptyMVar, putMVar)
import Control.Monad.State
import qualified Data.ByteString.Char8 as B
import Data.Char (toLower)
import Data.Maybe (listToMaybe)
import System.Rando... | shak-mar/botstrats | server/Game.hs | Haskell | mit | 4,115 |
module Banjo where
areYouPlayingBanjo :: String -> String
areYouPlayingBanjo name@('R':xs) = name ++ " plays banjo"
areYouPlayingBanjo name@('r':xs) = name ++ " plays banjo"
areYouPlayingBanjo name = name ++ " does not play banjo"
| dzeban/haskell-exercises | Banjo.hs | Haskell | mit | 232 |
{-# LANGUAGE ExistentialQuantification, Rank2Types #-}
module Control.Monad.Trans.Store where
import qualified Data.Map as M
import Control.Monad
import Control.Monad.Hoist
import Control.Monad.Trans
-- The semantics of store should be that it continues as soon as the reference
-- has been calculated, but that the ... | DanielWaterworth/siege | src/Control/Monad/Trans/Store.hs | Haskell | mit | 2,617 |
{-# LANGUAGE OverloadedStrings, RecordWildCards #-}
module Main where
import Text.XML.HXT.Core
main = do
runX (readDocument [ withValidate no, withParseHTML yes, withInputEncoding utf8 ] ""
>>> processChildren (process1 `when` isElem)
>>> writeDocument [] "-"
)
process1 :: ArrowXml a => ... | danchoi/hxt-nav | Main.hs | Haskell | mit | 1,011 |
main = print $ (foldl1 cross $ map (`map` [1..]) [t, p, h]) !! 2
t n = n * ( n + 1) `div` 2
p n = n * (3 * n - 1) `div` 2
h n = n * (2 * n - 1)
-- Lazily intersects ordered lists
cross a@(x:xs) b@(y:ys)
| x > y = cross a ys
| x < y = cross xs b
| otherwise = x : cross xs ys
| nickspinale/euler | complete/045.hs | Haskell | mit | 293 |
module Azure.BlobStorage.Util where
import qualified Blaze.ByteString.Builder as Builder
import Control.Applicative
import Control.Monad.Reader hiding (forM)
import Data.ByteString (ByteString)
import qualified Data.ByteString as BS
import qualified Data.ByteString.Base64 as Base64
import... | fpco/schoolofhaskell.com | src/Azure/BlobStorage/Util.hs | Haskell | mit | 2,517 |
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
module Ch15.SupplyClass ( S.Supply
, S.runSupply
, S.runRandomSupply
, MonadSupply (..)
)
wher... | futtetennista/IntroductionToFunctionalProgramming | RWH/src/ch15/SupplyClass.hs | Haskell | mit | 677 |
module Main
where
import Data.List
import Light.Cameras
import Light.Film
import Light.Filters
import Light.Geometry
f :: Film
f = film (16, 12) (boxFilter (1, 1))
p1, p2 :: PerspectiveCamera
p1 = perspectiveCamera f (pi/3)
p2 = perspectiveCamera f (pi/2)
o :: OrthographicCamera
o = orthographicCamera f 1
getRays... | jtdubs/Light | src/App/CameraDiagrams.hs | Haskell | mit | 3,326 |
{-# LANGUAGE OverloadedStrings #-}
module Day13 (day13, day13', run) where
import Data.Attoparsec.Text
( Parser(..)
, char
, decimal
, endOfLine
, isHorizontalSpace
, many'
, option
, parseOnly
, string
, takeTill
)
import Data.Function (on)
import Data.List (groupBy, nub, s... | brianshourd/adventOfCode2015 | src/Day13.hs | Haskell | mit | 3,167 |
module U.Util.Components where
import qualified Data.Graph as Graph
import qualified Data.Map as Map
import qualified Data.Set as Set
import Data.Set (Set)
import Data.Maybe (fromMaybe)
-- | Order bindings by dependencies and group into components.
-- Each component consists of > 1 bindings, each of which depends
-- ... | unisonweb/platform | codebase2/util/U/Util/Components.hs | Haskell | mit | 1,739 |
k = 1000000007
ans m 0 = 1
ans m 1 = m
ans m n =
let n' = n `div` 2
x = ans m n'
y = ans m (n-2*n')
in
(x * x * y) `mod` k
main = do
l <- getLine
let (m:n:_) = map read $ words l :: [Integer]
o = ans m n
print o
| a143753/AOJ | NTL_1_B.hs | Haskell | apache-2.0 | 249 |
import Prelude
data Tree a = Node (Tree a) a (Tree a)
| Empty
deriving Show
areTreesEqual :: Tree Int -> Tree Int -> Bool
areTreesEqual Empty Empty = True
areTreesEqual Empty _ = False
areTreesEqual _ Empty = False
areTreesEqual (Node leftTree1 a rightTree1) (Node leftTree2 b rightTree2) =... | omefire/HaskellProjects | areTreesEqual.hs | Haskell | apache-2.0 | 1,047 |
module Explession where
level:: Int -> String -> Int
level lv (head:tail) | head == '(' && lv >= 0 = level (lv + 1) tail
| head == ')' && lv >= 0 = level (lv - 1) tail
| otherwise = lv
level lv ([]) = lv
{-
- Checks whether an expression contains a balanced amount of br... | art4ul/HaskellSandbox | Expression.hs | Haskell | apache-2.0 | 574 |
module Data.Binary.Get.Machine where
import Data.ByteString (ByteString)
import Data.Binary.Get (Decoder(..), Get, pushChunk, runGetIncremental)
import Data.Machine (MachineT(..), ProcessT, Step(Await, Yield), Is(Refl), stopped)
processGet :: Monad m => Get a -> ProcessT m ByteString a
processGet getA = processDecode... | aloiscochard/thinkgear | src/Data/Binary/Get/Machine.hs | Haskell | apache-2.0 | 645 |
{-# OPTIONS -fglasgow-exts #-}
-----------------------------------------------------------------------------
{-| Module : QAbstractTextDocumentLayout.hs
Copyright : (c) David Harley 2010
Project : qtHaskell
Version : 1.1.4
Modified : 2010-09-02 17:02:18
Warning : this file is machine ... | keera-studios/hsQt | Qtc/Gui/QAbstractTextDocumentLayout.hs | Haskell | bsd-2-clause | 28,773 |
{-# LANGUAGE BangPatterns #-}
import Control.Concurrent.STM as S
import qualified STMContainers.Map as TMap
import qualified ListT as LT
import qualified Data.ByteString.Char8 as L
import Control.Monad
import Debug.Trace
import System.Random
import Control... | lolepezy/rpki-pub-server | test/changeLog/changeLogList.hs | Haskell | bsd-2-clause | 2,612 |
{-# LANGUAGE RecordWildCards #-}
-- | A map from hashable keys to values.
module Data.DAWG.Gen.HashMap
( Hash (..)
, HashMap (..)
, empty
, lookup
, insertUnsafe
, lookupUnsafe
, deleteUnsafe
) where
import Prelude hiding (lookup)
-- import Control.Applicative ((<$>), (<*>))
-- import Data.Binary (Binary, Get, pu... | kawu/dawg-ord | src/Data/DAWG/Gen/HashMap.hs | Haskell | bsd-2-clause | 4,762 |
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-| Unittests for ganeti-htools.
-}
{-
Copyright (C) 2009, 2010, 2011, 2012, 2013 Google Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following condit... | ganeti-github-testing/ganeti-test-1 | test/hs/Test/Ganeti/OpCodes.hs | Haskell | bsd-2-clause | 33,826 |
-- 228
import Data.List(sort)
import Euler(splitOn)
parseTris [] = []
parseTris (x:xs) = t : parseTris xs
where xy = map read $ splitOn ',' x
t = sort $ zipWith toTheta (map (xy!!) [0,2,4]) (map (xy!!) [1,3,5])
toTheta a b = atan2 b a
containsOrigin xs
| length xs /= 3 = error "containsOri... | higgsd/euler | hs/102.hs | Haskell | bsd-2-clause | 658 |
{-# LANGUAGE OverloadedStrings #-}
module Appoint.Users where
import Control.Lens
import Control.Monad.Reader
import Data.Monoid ((<>))
import Appoint.Types.Config
import Appoint.Types.Users (User(..), Collaborators(..))
import qualified Data.Text as T
import qualified Data.Vector as V
import qualified GitHub.Data as G... | rob-b/appoint | src/Appoint/Users.hs | Haskell | bsd-3-clause | 1,168 |
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeFamilies #-}
module Futhark.Pass.ExtractKernels.BlockedKernel
( blockedReduction
, blockedReductionStream
, blockedMap
, blockedScan
, blockedSegmentedScan
, blockedKernelSize
, chunkLambda
, mapKernel
, ... | mrakgr/futhark | src/Futhark/Pass/ExtractKernels/BlockedKernel.hs | Haskell | bsd-3-clause | 24,449 |
{-# LANGUAGE TypeFamilies, MultiParamTypeClasses #-}
module Data.Number.LogFloat.Vector () where
import Data.Number.LogFloat
import Data.Vector.Unboxed
import Control.Monad
import qualified Data.Vector.Unboxed.Base
import qualified Data.Vector.Generic.Mutable as M
import qualified Data.Vector.Generic as G
newtype ... | bgamari/logfloat-unboxed | Data/Number/LogFloat/Vector.hs | Haskell | bsd-3-clause | 2,503 |
module Handler.CampaignNew where
import Import
import Import.Premium (hasPremium)
import Import.Semantic (renderSemantic)
campaignForm :: UserId -> Form Campaign
campaignForm user = renderSemantic $ Campaign
<$> areq textField "Name" Nothing
<*> pure user
getCampaignNewR :: Handler... | sulami/hGM | Handler/CampaignNew.hs | Haskell | bsd-3-clause | 1,210 |
module Forum.Internal (module X) where
import Forum.Internal.SQL as X
import Forum.Internal.Class as X
import Forum.Internal.Types as X
import Forum.Internal.Decoding as X
| turingjump/forum | src/Forum/Internal.hs | Haskell | bsd-3-clause | 173 |
{- |
Copyright : 2014 Tomáš Musil
License : BSD-3
Stability : experimental
Portability : portable
Nearest Neighbour heuristic for TSP.
-}
module Problems.TSP.NN
( optimize
) where
import Control.Arrow
--import Data.List.Stream
--import Prelude hiding ((++), lines, map, minimum, splitAt, sum, repeat, t... | tomasmcz/discrete-opt | src/Problems/TSP/NN.hs | Haskell | bsd-3-clause | 1,320 |
{-# LANGUAGE QuasiQuotes #-}
import LiquidHaskell
import Language.Haskell.Liquid.Prelude
foo x y
| compare x y == EQ = liquidAssertB (x == y)
| compare x y == LT = liquidAssertB (x < y)
| compare x y == GT = liquidAssertB (x > y)
prop = foo n m
where n = choose 0
m = choose 1
| spinda/liquidhaskell | tests/gsoc15/unknown/pos/compare1.hs | Haskell | bsd-3-clause | 299 |
{-|
Module : Werewolf.Command.Unvote
Description : Handler for the unvote subcommand.
Copyright : (c) Henry J. Wylde, 2016
License : BSD3
Maintainer : public@hjwylde.com
Handler for the unvote subcommand.
-}
module Werewolf.Command.Unvote (
-- * Handle
handle,
) where
import Control.Lens
import ... | hjwylde/werewolf | app/Werewolf/Command/Unvote.hs | Haskell | bsd-3-clause | 1,584 |
module Main where
import MixedTypesNumPrelude
-- import qualified Prelude as P
-- import Control.Applicative (liftA2)
import System.Environment
import AERN2.MP
-- import qualified AERN2.MP.Ball as MPBall
import AERN2.Poly.Cheb
import AERN2.Poly.Cheb.Maximum
import AERN2.Poly.Cheb.MaxNaive
import qualified AERN2.Lo... | michalkonecny/aern2 | aern2-fnreps/main/waac-benchmarks.hs | Haskell | bsd-3-clause | 3,999 |
module Data.Symbol.UnitTest(tests) where
import Data.Symbol
import Test.HUnit
tests = TestList [
"name (symbol i s) = s" ~: "s" ~?= (name (symbol 1 "s")),
"(symbol 1 s) == (symbol 1 s)" ~:
assertBool "" ((symbol 1 "s") == (symbol 1 "s")),
"unused == unused" ~: assertBool "" (unused == unused),
"(symbol 1 ... | emc2/proglang-util | Data/Symbol/UnitTest.hs | Haskell | bsd-3-clause | 937 |
module M06MultipleChildren where
import Rumpus
{-
You can call spawnChild as many times as you like.
Let's create a field of dreams:
```
-}
start :: Start
start = do
forM_ [0..99] $ \i -> do
let x = (fromIntegral (i `mod` 10) - 5) * 0.1
z = (fromIntegral (i `div` 10) - 5) * 0.1
... | lukexi/rumpus | pristine/Coding Guide/M06MultipleChildren.hs | Haskell | bsd-3-clause | 759 |
module Main where
import Language
main :: IO ()
main = putStr $ unlines [show vs ++ " -> " ++ show (interpret peg time_env)
| (vs, time_env) <- iterations labels]
where
(labels, peg) = figure_3_c
iterations [] = [([], emptyTimeEnv)]
iterations (l:ls) = do
v <- [0..10... | batterseapower/pegs | Main.hs | Haskell | bsd-3-clause | 1,529 |
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Main where
import Control.Applicative
import Control.Monad.Loops
import Control.Monad.State.Strict
import qualified Data.Attoparsec.Char8 as A
import qualified Data.ByteString.Char8 as B
import Data.List.Zipper
import System.Environment
newtype BF a = BF { unBF :: S... | tanakh/brainfuck | main.hs | Haskell | bsd-3-clause | 1,182 |
{-# LANGUAGE UndecidableInstances #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Forum.Internal.Decoding where
import Bookkeeper
import Hasql.Class (Decodable(decode))
import Hasql.Decoders (Row)
import Data.Proxy
instance (All Decodable entries) => Decodable (Book' Identity entries) where
decode = decodeBook
de... | turingjump/forum | src/Forum/Internal/Decoding.hs | Haskell | bsd-3-clause | 560 |
{-# LANGUAGE TupleSections #-}
module KMeans
( Point
, Cluster
, localKMeans
, distrKMeans
, createGnuPlot
, __remoteTable
) where
import System.IO
import Data.List (minimumBy)
import Data.Function (on)
import Data.Array (Array, (!), bounds)
import qualified Data.Map as Map (fromList, elems, toList, size... | haskell-distributed/distributed-process-demos | src/MapReduce/KMeans.hs | Haskell | bsd-3-clause | 4,139 |
{-# LANGUAGE CPP #-}
-- | This module reexports the six necessary type classes that every 'Rule' type must support.
-- You can use this module to define new rules without depending on the @binary@, @deepseq@ and @hashable@ packages.
module Development.Shake.Classes(
Show(..), Typeable(..), Eq(..), Hashable(..), ... | nh2/shake | Development/Shake/Classes.hs | Haskell | bsd-3-clause | 440 |
module Methods where
import qualified Data.ByteString.Lazy.Char8 as C
import qualified Data.ByteString.Lazy as L
import Data.List
import System.IO
import Data.Word
import Data.Binary.Get
import Data.Int
import Memory
assure :: Maybe a -> a
assure (Just a) = a
assure _ = error "Error: can't convert Nothing to v... | skill-lang/skill | deps/haskell/Methods.hs | Haskell | bsd-3-clause | 8,340 |
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE TemplateHaskell #-}
{-# ... | tomberek/RETE | src/RETE/Lib4.hs | Haskell | bsd-3-clause | 11,486 |
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
-- {-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE Flexible... | reuleaux/pire | src/Pire/Syntax/Expr.hs | Haskell | bsd-3-clause | 48,148 |
{-|
Module : Graphics.Sudbury.Protocol.Runtime
Description : Protocol data without docs: can project XML protocols to runtime protocols
Copyright : (c) Auke Booij, 2015-2017
License : MIT
Maintainer : auke@tulcod.com
Stability : experimental
Portability : POSIX
-}
module Graphics.Sudbury.Protocol.Runtime ... | abooij/sudbury | Graphics/Sudbury/Protocol/Runtime.hs | Haskell | mit | 326 |
-------------------------------------------------------------------------
--
-- MakeTree.hs
--
-- Turn a frequency table into a Huffman tree
--
-- (c) Addison-Wesley, 19... | Numberartificial/workflow | snipets/src/Craft/Chapter15/MakeTree.hs | Haskell | mit | 1,891 |
{-
Copyright 2019 The CodeWorld Authors. All rights reserved.
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 applicab... | alphalambda/codeworld | codeworld-compiler/test/testcases/varlessPattern/source.hs | Haskell | apache-2.0 | 648 |
{-# OPTIONS -#include <windows.h> #-}
{-# OPTIONS -#include "SafeArrayPrim.h" #-}
-- Automatically generated by HaskellDirect (ihc.exe), version 0.20
-- Created: 20:11 Pacific Standard Time, Tuesday 16 December, 2003
-- Command line: -fno-qualified-names -fhs-to-c -fno-export-lists --gen-headers -fout-pointers-are-... | sof/hdirect | comlib/SafeArray.hs | Haskell | bsd-3-clause | 12,123 |
-- | Parallel Arrays.
---
-- Parallel arrays use a fixed generic representation. All data stored in
-- them is converted to the generic representation, and we have a small
-- number of operators that work on arrays of these generic types.
--
-- Representation types include Ints, Floats, Tuples and Sums, so arr... | mainland/dph | dph-lifted-copy/Data/Array/Parallel/PArray.hs | Haskell | bsd-3-clause | 7,497 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.