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 |
|---|---|---|---|---|---|
folder f a xs = foldM f a xs >> return () | mpickering/hlint-refactor | tests/examples/Monad18.hs | Haskell | bsd-3-clause | 41 |
{-# LANGUAGE OverloadedStrings #-}
{-
A simple HTTP server that serves static source and data files
for tests, and additionally supports some dynamic responses:
-}
module Server (startServer) where
import Control.Concurrent
import qualified Control.Exception as E
import Control.Monad
import ... | ryantrinkle/ghcjs | test/Server.hs | Haskell | mit | 8,755 |
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Util.Themes
-- Copyright : (C) 2007 Andrea Rossato
-- License : BSD3
--
-- Maintainer : andrea.rossato@unibz.it
-- Stability : unstable
-- Portability : unportable
--
-- A (hopefully) growing collec... | adinapoli/xmonad-contrib | XMonad/Util/Themes.hs | Haskell | bsd-3-clause | 15,650 |
import System.Environment
main :: IO ()
main = do
[arg] <- getArgs
env <- getEnvironment
putStrLn "Running Background App."
putStrLn $ " Args: " ++ show arg
putStrLn $ "Environment: " ++ show env
putStrLn "Stopping Background App."
| telser/keter | incoming/foo1_0/worker.hs | Haskell | mit | 265 |
{-# LANGUAGE ApplicativeDo #-}
f :: Int -> IO Int
f x = do
y <- return (x + 1)
return (y * 2)
| sdiehl/ghc | testsuite/tests/ghci.debugger/scripts/break029.hs | Haskell | bsd-3-clause | 99 |
module T4007 where
f :: IO ()
f = sequence_ (replicate 10 (putStrLn "yes"))
| urbanslug/ghc | testsuite/tests/perf/compiler/T4007.hs | Haskell | bsd-3-clause | 78 |
-- Test for trac #1042
import Control.Exception
import Data.Int
main :: IO ()
main = do print ((minBound :: Int) `div` (-1)) `myCatch` print
print ((minBound :: Int8) `div` (-1)) `myCatch` print
print ((minBound :: Int16) `div` (-1)) `myCatch` print
print ((minBound :: Int32) `div` (... | urbanslug/ghc | testsuite/tests/numeric/should_run/numrun013.hs | Haskell | bsd-3-clause | 476 |
-- | Gearman specific stuff
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
module Vaultaire.Collector.Nagios.Perfdata.Gearman where
import Vaultaire.Collector.Nagios.Perfdata.Process
import Vaultaire.Collector.Nagios.Perfdata.Types
import Control.Concurrent
impor... | anchor/vaultaire-collector-nagios | lib/Vaultaire/Collector/Nagios/Perfdata/Gearman.hs | Haskell | mit | 3,503 |
module Main where
sum' :: (Num a) => [a] -> a
sum' xs = foldl (\acc x -> acc + x) 0 xs
sum2 :: (Num a) => [a] -> a
sum2 = foldl (+) 0
| rglew/lyah | foldl.hs | Haskell | mit | 137 |
{-# LANGUAGE OverloadedStrings #-}
-- | This module handles all of the scans requested by the user
module Scans (attachScanEvents, initScanState, scanShape,
ScanState(step,rotations,top,bottom,offset,choice),
scansReady, populateTable,dropScan,updateTitle,toFile,MouseState) where
import D... | rprospero/PhotoAlign | Scans.hs | Haskell | mit | 14,033 |
module Functors where
import Control.Lens
-- items from chapter 12 of Programming in Haskell 2nd Ed by Graham Hutton
inc :: [Int] -> [Int]
inc [] = []
inc (n:ns) = n+1 : inc ns
sqr :: [Int] -> [Int]
sqr [] = []
sqr (n:ns) = n^2 : sqr ns
map' :: (a -> b) -> [a] -> [b]
map' f [] = []
map' f (x:xs) = f x : map ... | brodyberg/LearnHaskell | CaesarCypher.hsproj/Functors.hs | Haskell | mit | 1,404 |
module Main where
import Control.Applicative
import Control.Concurrent.MVar
import Control.Concurrent
import Data.Time
import System.Environment
main = do
mv <- newEmptyMVar
start <- getCurrentTime
loop mv =<< read . head <$> getArgs
end <- getCurrentTime
putStrLn $ "creation time: " ++ show (diffUTCTime en... | nlim/haskell-playground | src/Threads.hs | Haskell | mit | 717 |
module Example where
import Data.Monoid
import Control.Monad
import Types
import Drum
import Play
import Dseq
beat1 = mconcat [ sequence_ [hi, hi, hi, hi],
sequence_ [bd, sn, bd, sn] ]
wassup = n2 bd >> n8 bd >> n4 sn >> n2 bd >> n8 bd >> n4 bd >> n2 sn
-- Trap Beat
-- Tempo: 210
h8 = replica... | reedrosenbluth/Djembe | src/Example.hs | Haskell | mit | 3,677 |
module GHCJS.DOM.SQLTransactionCallback (
) where
| manyoo/ghcjs-dom | ghcjs-dom-webkit/src/GHCJS/DOM/SQLTransactionCallback.hs | Haskell | mit | 52 |
{-# LANGUAGE PatternSynonyms #-}
-- For HasCallStack compatibility
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module JSDOM.Generated.SVGAElement
(getTarget, SVGAElement(..), gTypeSVGAElement) where
import Prelude ((.), (==), (>>=), return, IO, In... | ghcjs/jsaddle-dom | src/JSDOM/Generated/SVGAElement.hs | Haskell | mit | 1,265 |
{-|
Module : Text.LParse.TokenStream
Description : Underlying data structure for sequential parsing
Copyright : (c) Marcus Völker, 2017-2018
License : MIT
Maintainer : marcus.voelker@rwth-aachen.de
This module contains the `TokenStream` class, an abstraction of lists, similar to `Traversable`, but geared f... | MarcusVoelker/LParse | src/Text/LParse/TokenStream.hs | Haskell | mit | 2,078 |
{-# OPTIONS_GHC -fwarn-incomplete-patterns #-}
module BinaryTree2 where
-- an experiment to make a Binary tree where the values are stored at the leafs not the nodes.
-- trouble is it makes insertion problematic as I can't tell where to insert values in the tree.
-- so experiment aborted
data BinaryTree2 a =
... | NickAger/LearningHaskell | HaskellProgrammingFromFirstPrinciples/Chapter11.hsproj/BinaryTree2.hs | Haskell | mit | 764 |
{-# LANGUAGE CPP #-}
module GHCJS.DOM.HTMLTableSectionElement (
#if (defined(ghcjs_HOST_OS) && defined(USE_JAVASCRIPTFFI)) || !defined(USE_WEBKIT)
module GHCJS.DOM.JSFFI.Generated.HTMLTableSectionElement
#else
module Graphics.UI.Gtk.WebKit.DOM.HTMLTableSectionElement
#endif
) where
#if (defined(ghcjs_HOST_OS) && ... | plow-technologies/ghcjs-dom | src/GHCJS/DOM/HTMLTableSectionElement.hs | Haskell | mit | 500 |
import System.Environment
import Data.List
main = do
args <- getArgs
progName <- getProgName
putStrLn "The arguments are:"
mapM putStrLn args
putStrLn "The program name is:"
putStrLn progName
| fabriceleal/learn-you-a-haskell | 09/args.hs | Haskell | mit | 223 |
-- Note: we should only depend on libraries that ship with GHC for this. No
-- external dependencies!
import Control.Monad (when)
import Data.List (concat, isPrefixOf)
import Data.Version (Version, parseVersion)
import Prelude ... | fpco/minghc | minghc-post-install.hs | Haskell | mit | 4,306 |
module E10 where
data MyType = TypeOne String
| TypeTwo String
definition :: TypeOne -> Bool
definition (TypeOne aString) = True
{-
-} | pascal-knodel/haskell-craft | Examples/· Errors/E10.hs | Haskell | mit | 173 |
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE PackageImports #-}
{-
Copyright 2018 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:... | tgdavies/codeworld | codeworld-base/src/Internal/Text.hs | Haskell | apache-2.0 | 3,631 |
-- | read-write lock specialized for using LMDB with MDB_NOLOCK option
--
module Database.VCache.RWLock
( RWLock
, newRWLock
, withRWLock
, withRdOnlyLock
) where
import Control.Monad
import Control.Exception
import Control.Concurrent.MVar
import Data.IORef
import Data.IntSet (IntSet)
import quali... | bitemyapp/haskell-vcache | hsrc_lib/Database/VCache/RWLock.hs | Haskell | bsd-2-clause | 4,694 |
-- | This module exports the templates for automatic instance deriving of "Transformation.Shallow" type classes. The most
-- common way to use it would be
--
-- > import qualified Transformation.Shallow.TH
-- > data MyDataType f' f = ...
-- > $(Transformation.Shallow.TH.deriveFunctor ''MyDataType)
--
{-# Language CPP,... | blamario/grampa | deep-transformations/src/Transformation/Shallow/TH.hs | Haskell | bsd-2-clause | 17,642 |
{-# OPTIONS -fglasgow-exts #-}
-----------------------------------------------------------------------------
{-| Module : QPainterPath.hs
Copyright : (c) David Harley 2010
Project : qtHaskell
Version : 1.1.4
Modified : 2010-09-02 17:02:35
Warning : this file is machine generated - do ... | keera-studios/hsQt | Qtc/Enums/Gui/QPainterPath.hs | Haskell | bsd-2-clause | 2,596 |
module Main (main) where
import Test.Framework (defaultMain)
import qualified Database.Redis.Tags.Test.Tags
main :: IO ()
main = defaultMain [
Database.Redis.Tags.Test.Tags.tests
]
| akaspin/hedis-tags | test/Main.hs | Haskell | bsd-2-clause | 206 |
module UniversalSyntax(
VarName, DataConName, Literal,
Type,
var, dataCon, intLit, floatLit, charLit,
getVarName, getDataConName) where
-- This is a module for syntax elements that are the same across all intermediate
-- representations, from the core syntax to the imperative representation
data Type
= Type... | dillonhuff/AFL | src/UniversalSyntax.hs | Haskell | bsd-3-clause | 832 |
{-# LANGUAGE TypeOperators, CPP #-}
#include "macros.h"
LANGUAGE_UNSAFE
module Type.Eq.Higher.Unsafe (module Type.Eq.Unsafe, module Type.Eq.Higher.Unsafe) where
import Type.Eq.Unsafe
import {-# SOURCE #-} Type.Eq.Higher
import Unsafe.Coerce
-- | Very unsafe! The same rules apply as for 'unsafeCoerce'.
unsafeCoerci... | glaebhoerl/type-eq | Type/Eq/Higher/Unsafe.hs | Haskell | bsd-3-clause | 679 |
{-# LANGUAGE RankNTypes #-}
{-| An ST Monad based interface to the CUDD BDD library
This is a straightforward wrapper around the C library. See <http://vlsi.colorado.edu/~fabio/CUDD/> for documentation.
Exampe usage:
> import Control.Monad.ST
> import Cudd.Imperative
>
> main = do
> res <- stToIO $ withManager... | adamwalker/haskell_cudd | Cudd/Imperative.hs | Haskell | bsd-3-clause | 17,777 |
module Linear.Cassowary.ClSimplexSolver where
-- addConstraint :: ClSimplexSolver -> ClConstraint -> IO ()
-- removeConstraint :: ClSimplexSolver -> ClConstraint -> IO ()
-- addEditVar :: ClSimplexSolver -> ClVariable -> ClStrength -> IO ()
-- removeEditVar :: ClSimplexSolver -> ClVariable -> IO ()
-- beginEdit ... | athanclark/cassowary-haskell | src/Linear/Cassowary/ClSimplexSolver.hs | Haskell | bsd-3-clause | 761 |
module Util.Sort (quicksort) where
quicksort :: (Ord a) => [a] -> [a]
quicksort [] = []
quicksort (x:xs) = quicksort left ++ [x] ++ quicksort right
where left = [ y | y <- xs, y <= x ]
right = [ y | y <- xs, x < y ]
| masateruk/haskell-dev-env | Util/Sort.hs | Haskell | bsd-3-clause | 232 |
{-# LANGUAGE OverloadedStrings #-}
{- |
Description: low-level SMTP communciation.
-}
module Network.Mail.SMTP.SMTPRaw (
SMTPRaw(..)
, smtpConnect
, smtpSendCommand
, smtpSendCommandAndWait
, smtpSendRaw
, smtpGetReplyLines
, smtpDisconnect
) where
import qualified Data.ByteString as B
import ... | avieth/smtp-mail-ng | Network/Mail/SMTP/SMTPRaw.hs | Haskell | bsd-3-clause | 2,500 |
{-# LANGUAGE CPP, QuasiQuotes, TemplateHaskell #-}
-- |
-- Template Haskell to generate defaultMain with a list of "Test" from
-- \"doc_test\", \"case_\<somthing\>\", and \"prop_\<somthing\>\".
--
-- An example of source code (Data/MySet.hs):
--
-- > {-| Creating a set from a list. O(N log N)
-- >
-- > >>> empty == fr... | kazu-yamamoto/test-framework-th-prime | Test/Framework/TH/Prime.hs | Haskell | bsd-3-clause | 4,160 |
module AI.MathTmp
where
import Data.List
-- Math functions copied from Math.Statistics because the whole thing wouldn't compile
mean :: Floating a => [a] -> a
mean x = fst $ foldl' (\(m, n) x -> (m+(x-m)/(n+1),n+1)) (0,0) x
-- mean x = fst $ foldl' (\(!m, !n) x -> (m+(x-m)/(n+1),n+1)) (0,0) x
-- |A... | mikeizbicki/Classification | src/AI/MathTmp.hs | Haskell | bsd-3-clause | 1,562 |
{-# LANGUAGE
MultiParamTypeClasses
, TemplateHaskell
, ScopedTypeVariables
, FlexibleInstances
, FlexibleContexts
, UndecidableInstances
#-}
module Spire.Canonical.Checker where
import Control.Monad.Except
import Unbound.LocallyNameless hiding ( Spine )
import Spire.Canonical.Types
import Spire.Canonic... | spire/spire | src/Spire/Canonical/Checker.hs | Haskell | bsd-3-clause | 11,060 |
module Parser where
import Control.Applicative
import Control.Monad
import Data.Char
newtype Parser a = Parser (String -> [(a, String)])
apply :: Parser a -> String -> [(a, String)]
apply (Parser f) s = f s
parse :: Parser a -> String -> a
parse m s = one [x | (x, t) <- apply m s, t== ""]
where
one [] = error... | bzhkl/MonadTry | LibParser/Parser.hs | Haskell | bsd-3-clause | 2,792 |
{-# LANGUAGE BangPatterns #-}
module Network.DNS.Cache.Cache (
CacheRef
, newCacheRef
, lookupCacheRef
, insertCacheRef
, pruneCacheRef
) where
import Control.Applicative ((<$>))
import Data.IORef (newIORef, readIORef, atomicModifyIORef', IORef)
import Data.OrdPSQ (OrdPSQ)
import qualified Data.OrdPSQ a... | kazu-yamamoto/concurrent-dns-cache | Network/DNS/Cache/Cache.hs | Haskell | bsd-3-clause | 957 |
-- generated by derive.hs
module Prose.Internal.GraphemeBreakTest where
graphemebreaktest = [
[" "," "],
[" \776"," "],
[" ","\r"],
[" \776","\r"],
[" ","\n"],
[" \776","\n"],
[" ","\SOH"],
[" \776","\SOH"],
[" \768"],
[" \776\768"],
[" \2307"],
[" \776\2307"],
[" ","... | llelf/prose | Prose/Internal/GraphemeBreakTest.hs | Haskell | bsd-3-clause | 9,759 |
-- -----------------------------------------------------------------------------
--
-- (c) The University of Glasgow, 2011
--
-- Generate code to initialise cost centres
--
-- -----------------------------------------------------------------------------
module ProfInit (profilingInitCode) where
import GhcPrelude
imp... | sdiehl/ghc | compiler/profiling/ProfInit.hs | Haskell | bsd-3-clause | 2,228 |
module Graphics.Volume.MarchingCubes where
import Graphics.Volume.MarchingCubesTables
import Numeric.ScalarField
import Control.Lens
import Data.Bits
import qualified Data.Vector as V
import Linear
-- | Calculates the isosurface of a scalar field in three dimensional euclidian space.
ma... | fatho/volume | src/Graphics/Volume/MarchingCubes.hs | Haskell | bsd-3-clause | 3,878 |
module IA.GA
(
GenoType
, GenoTypes
, PhenoType
, Population
, Select
, CrossOver
, Mutate
, Fitness
, FitnessType(..)
, mkFitness
, mkSelect
, mkCrossOver
, mkMutate
, binaryTournament
, runGA
, randomRSt
, randomSt
, GeneBits(..)
, muta... | dlgd/GA | src/IA/GA.hs | Haskell | bsd-3-clause | 5,977 |
{-# LANGUAGE CPP #-}
module Distribution.Simple.UUAGC.UUAGC(uuagcUserHook,
uuagcUserHook',
uuagc,
uuagcLibUserHook,
uuagcFromString
... | norm2782/uuagc | cabal-plugin/src/Distribution/Simple/UUAGC/UUAGC.hs | Haskell | bsd-3-clause | 12,604 |
module TestFactorial where
import Factorial
import TestUtil
ff :: Int
--ff = 2 ^ 27
ff = 6
run :: IO ()
run = do
putStrLn ("factorial1 " ++ show ff ++ " = " ++ show (factorial1 ff))
putStrLn ("factorial2 " ++ show ff ++ " = " ++ show (factorial2 ff))
| pmilne/algebra | test/TestFactorial.hs | Haskell | bsd-3-clause | 275 |
{-
Copyright James d'Arcy 2010
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the followi... | jamesdarcy/DicomH | src/Data/Dicom/Tag.hs | Haskell | bsd-3-clause | 2,638 |
{-
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998
Error-checking and other utilities for @deriving@ clauses or declarations.
-}
{-# LANGUAGE TypeFamilies #-}
module TcDerivUtils (
DerivM, DerivEnv(..),
DerivSpec(..), pprDerivSpec,
DerivSpecMechan... | shlevy/ghc | compiler/typecheck/TcDerivUtils.hs | Haskell | bsd-3-clause | 36,389 |
{-# LANGUAGE PatternSynonyms #-}
module QueryArrow.FileSystem.Builtin where
import QueryArrow.Syntax.Term
import QueryArrow.Syntax.Type
import QueryArrow.Syntax.Utils
pattern FilePathPredName ns = QPredName ns [] "FILE_PATH"
pattern DirPathPredName ns = QPredName ns [] "DIR_PATH"
pattern FileIdPredName n... | xu-hao/QueryArrow | QueryArrow-db-filesystem/src/QueryArrow/FileSystem/Builtin.hs | Haskell | bsd-3-clause | 5,033 |
module ML
( module ML.Num
, module ML.V2
, module ML.V3
, module ML.V4
, module ML.M2
, module ML.M3
, module ML.M4
, module ML.Q
) where
import ML.Num
import ML.V2
import ML.V3
import ML.V4
import ML.M2
import ML.M3
import ML.M4
import ML.Q
| jxv/ml-hs | src/ML.hs | Haskell | bsd-3-clause | 280 |
module LeapYearKata.Day2 (isLeapYear) where
isLeapYear :: Int -> Bool
isLeapYear year = (isDivisibleByFour $ div year 100) && isDivisibleByFour year
where
isDivisibleByFour :: Int -> Bool
isDivisibleByFour num = num `mod` 4 == 0
| Alex-Diez/haskell-tdd-kata | old-katas/src/LeapYearKata/Day2.hs | Haskell | bsd-3-clause | 270 |
{-# LANGUAGE TupleSections #-}
module Language.Haskell.Liquid.Bare.RTEnv (
makeRTEnv
) where
import Prelude hiding (error)
import Data.Graph hiding (Graph)
import Data.Maybe
import qualified Control.Exception as Ex
import qualified Data.HashMap.Strict as M
import qualified Data.List as L
import L... | ssaavedra/liquidhaskell | src/Language/Haskell/Liquid/Bare/RTEnv.hs | Haskell | bsd-3-clause | 5,742 |
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
module React.Flux.Mui.DropDownMenu where
import Protolude
import Data.Aeson
import Data.Aeson.Casing
import Data.String (String)
import React.Flux
import React.Flux.Mui.Util
data DropDownMenu = DropDownMenu
{ dropDownMenuAnimated :: !(Maybe Bool)
... | pbogdan/react-flux-mui | react-flux-mui/src/React/Flux/Mui/DropDownMenu.hs | Haskell | bsd-3-clause | 1,216 |
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE FlexibleContexts #-}
module Data.PList.Binary ( PList(..)
, _PBool
, _PInt
... | tkonolige/haskell-bplist | src/Data/PList/Binary.hs | Haskell | bsd-3-clause | 12,833 |
module System.Mesos.Raw.MasterInfo where
import System.Mesos.Internal
type MasterInfoPtr = Ptr MasterInfo
foreign import ccall unsafe "ext/types.h toMasterInfo" c_toMasterInfo
:: Ptr CChar -- infoID
-> CInt -- infoIDLen
-> CUInt -- infoIP
-> Ptr CUInt -- infoPort
-> Ptr CChar -- pid
-> CInt -- p... | Atidot/hs-mesos | src/System/Mesos/Raw/MasterInfo.hs | Haskell | mit | 2,231 |
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TemplateHaskell #-}
module Rackspace.MailGun
( Message (..)
, sendMessage
, sendWith
) where
import Control.Monad.Cat... | AndrewRademacher/mailgun | src/Rackspace/MailGun.hs | Haskell | mit | 2,765 |
module Main where
import qualified Api.Server as S
main :: IO ()
main = S.main
| Geeroar/ut-haskell | src/Main.hs | Haskell | apache-2.0 | 81 |
{-|
Module : Models.TimedAutomaton
Description : A (simplified) type for Timed Automata (TA) extended as in the UPPAAL tool (and XTA format).
Copyright : (c) 2017 Pascal Poizat
License : Apache-2.0 (see the file LICENSE)
Maintainer : pascal.poizat@lip6.fr
Stability : experimental
Portability : unknown
-}
... | pascalpoizat/veca-haskell | src/Models/TimedAutomaton.hs | Haskell | apache-2.0 | 15,955 |
<?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="fil-PH">
<title>Ang Port Scan | ZAP Extension</title>
<maps>
<homeID>top</homeID>
<map... | veggiespam/zap-extensions | addOns/scripts/src/main/javahelp/org/zaproxy/zap/extension/scripts/resources/help_fil_PH/helpset_fil_PH.hs | Haskell | apache-2.0 | 989 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.