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 GeneralizedNewtypeDeriving #-}
module Orville.PostgreSQL.Internal.Expr.TableDefinition
( CreateTableExpr,
createTableExpr,
PrimaryKeyExpr,
primaryKeyExpr,
AlterTableExpr,
alterTableExpr,
AlterTableAction,
addColumn,
dropColumn,
addConstraint,
dropConstraint,
a... | flipstone/orville | orville-postgresql-libpq/src/Orville/PostgreSQL/Internal/Expr/TableDefinition.hs | Haskell | mit | 5,986 |
module Haskeroids.Initialize where
import Graphics.Rendering.OpenGL
import Graphics.UI.GLUT
import Haskeroids.Callbacks
-- | Set up the main application window
initializeWindow = do
_ <- getArgsAndInitialize
initialWindowSize $= Size 800 600
initialDisplayMode $= [DoubleBuffered]
createWindow "Haske... | shangaslammi/haskeroids | Haskeroids/Initialize.hs | Haskell | mit | 1,154 |
{-# OPTIONS_GHC -fno-warn-type-defaults #-}
import Data.Foldable (for_)
import Test.Hspec (Spec, describe, it, shouldBe)
import Test.Hspec.Runner (configFastFail, defaultConfig, hspecWith)
import Say (inEnglish)
main :: IO ()
main = hspecWith defaultConfig {configFastFail = True} specs
specs :: Spec
spec... | exercism/xhaskell | exercises/practice/say/test/Tests.hs | Haskell | mit | 2,217 |
module Lesson2.UCS.Enumerator where
import Control.Monad.Trans (MonadIO, liftIO)
import Data.Lens.Common (getL)
import Data.Enumerator (
Stream(..)
, Step(..)
, Iteratee(..)
, Enumerator
, (>>==)
, returnI
, continue
, yield
)
import Data.Hashable (Hashable(..))
import Data.Maybe (fromJust)
import ... | roman/ai-class-haskell | src/Lesson2/UCS/Enumerator.hs | Haskell | mit | 1,056 |
import Primes
import Utils
lengthGreater3 :: [a] -> Bool
lengthGreater3 (a:b:c:d:xs) = True
lengthGreater3 _ = False
morethanFourFactors = lengthGreater3 . primeFactors
pairs = map (\n -> (n,morethanFourFactors n)) [2..]
firstFourTrue :: [(Integer, Bool)] -> Integer
firstFourTrue ((n1,b1):(n2,b2):(n3,b3):(n4,b4):xs... | arekfu/project_euler | p0047/p0047.hs | Haskell | mit | 475 |
{-# LANGUAGE OverloadedStrings, TemplateHaskell #-}
module Leankit.Types.Card where
import Control.Applicative ((<$>))
import Data.Aeson
import Data.Aeson.TH
import Data.List.Split
import Leankit.Types.TH
import Leankit.Types.Common
import Leankit.Types.AssignedUser (AssignedUser)
import Leankit.Types.CardContext (... | dtorok/leankit-hsapi | Leankit/Types/Card.hs | Haskell | mit | 3,555 |
{-# htermination elemFM :: (Ord a, Ord k) => (Either a k) -> FiniteMap (Either a k) b -> Bool #-}
import FiniteMap
| ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/full_haskell/FiniteMap_elemFM_10.hs | Haskell | mit | 115 |
module Test.Smoke.Spec.PathGenerator
( genAbsoluteFilePath,
genRelativeDir,
genRelativeFile,
genRelativeFilePath,
genNamedSegment,
)
where
import qualified Data.List as List
import Hedgehog
import qualified Hedgehog.Gen as Gen
import qualified Hedgehog.Range as Range
import qualified System.FilePat... | SamirTalwar/Smoke | src/test/Test/Smoke/Spec/PathGenerator.hs | Haskell | mit | 2,065 |
{-# LANGUAGE CPP #-}
{-# LANGUAGE TemplateHaskell #-}
{-|
Module : Main
Description : Main module running the GMM
Copyright : (c) Julian Kopka Larsen, 2015
Stability : experimental
-}
module Main (
main
) where
import Control.Monad (forM, unless)
import Data.Lis... | juliankopkalarsen/FpStats | GMM/src/Main.hs | Haskell | mit | 3,730 |
{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -fno-warn-missing-import-lists #-}
{-# OPTIONS_GHC -fno-warn-implicit-prelude #-}
module Paths_robot_simulator (
version,
getBinDir, getLibDir, getDynLibDir, getDataDir, getLibexecDir,
getDataFileName, getSysconfDir
) where
import qualified Control.Exception as Except... | c19/Exercism-Haskell | robot-simulator/.stack-work/dist/x86_64-osx/Cabal-1.24.2.0/build/autogen/Paths_robot_simulator.hs | Haskell | mit | 2,476 |
module Nauva.CSS
( module X
) where
import Nauva.CSS.Helpers as X
import Nauva.CSS.Terms as X
import Nauva.CSS.Typeface as X
import Nauva.CSS.Types as X
| wereHamster/nauva | pkg/hs/nauva-css/src/Nauva/CSS.hs | Haskell | mit | 169 |
module Main where
import qualified Graphics.UI.SDL as SDL
import Reactive.Banana
import Reactive.Banana.Frameworks (actuate)
import Reactive.Banana.SDL
import Hage.Graphics
import Hage.Game.Arkanoid.EventNetwork
main :: IO ()
main = do
sdlES <- getSDLEventSource
gd <- initGraphics
network <- compile $ se... | Hinidu/Arkanoid | src/Hage/Game/Arkanoid.hs | Haskell | mit | 403 |
{-# LANGUAGE NoImplicitPrelude, PackageImports #-}
module Test where
import "base-compat-batteries" Data.Ratio.Compat
| haskell-compat/base-compat | check/check-hs/Data.Ratio.Compat.check.hs | Haskell | mit | 118 |
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
That line was so long
Phew | ke00n/alabno | backend/linter/testFiles/longLineFile.hs | Haskell | mit | 156 |
-- Converts .lhs (literary Haskell files) to .hs (plain Haskell files)
-- Keeps only the statements which are normally compiled, plus blank lines.
-- To use:
-- ghc --make lhs2hs.hs
-- to get an executable file lhs2hs.
-- Then
-- lhs2hs filename
-- will open filename.lhs and save the converted file in filenam... | AlexMckey/FP101x-ItFP_Haskell | Sources/lhs2hs_.hs | Haskell | cc0-1.0 | 1,360 |
myLength :: [t] -> Int
myLength [] = 0
myLength (x:xs) = myLength xs + 1 | alephnil/h99 | 04.hs | Haskell | apache-2.0 | 72 |
{-# LANGUAGE BangPatterns #-}
module Database.VCache.VRef
( VRef
, vref, deref
, vref', deref'
, unsafeVRefAddr
, unsafeVRefRefct
, vref_space
, CacheMode(..)
, vrefc, derefc
, withVRefBytes
, unsafeVRefEncoding
) where
import Control.Monad
import Data.IORef
import Data.B... | dmbarbour/haskell-vcache | hsrc_lib/Database/VCache/VRef.hs | Haskell | bsd-2-clause | 6,043 |
module RuntimeProcessManager (withRuntimeProcess) where
import JavaUtils (getClassPath)
import StringPrefixes (namespace)
import System.IO (Handle, hSetBuffering, BufferMode(..))
import System.Process
withRuntimeProcess :: String -> BufferMode -> ((Handle,Handle) -> IO a) -> Bool -> IO a
withRuntimeProcess... | bixuanzju/fcore | lib/services/RuntimeProcessManager.hs | Haskell | bsd-2-clause | 797 |
{- Copyright (c) 2008 David Roundy
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following... | droundy/franchise | Distribution/Franchise/ListUtils.hs | Haskell | bsd-3-clause | 2,222 |
module HsImport.Types where
import qualified Language.Haskell.Exts as HS
type SrcLine = Int
type SrcColumn = Int
type SrcSpan = HS.SrcSpan
type SrcLoc = HS.SrcLoc
type Annotation = (HS.SrcSpanInfo, [HS.Comment])
type Decl = HS.Decl Annotation
type ImportDecl = HS.ImportDe... | dan-t/hsimport | lib/HsImport/Types.hs | Haskell | bsd-3-clause | 1,919 |
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE FlexibleContexts #-}
module Elm.Package.Description where
import Prelude hiding (read)
import Control.Applicative ((<$>))
import Control.Arrow (first)
import Control.Monad.Trans (MonadIO, liftIO)
import Control.Monad.Error.Class (MonadError, throwError)
import Control.Mo... | laszlopandy/elm-package | src/Elm/Package/Description.hs | Haskell | bsd-3-clause | 8,771 |
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
{-|
Module : Numeric.AERN.RealArithmetic.Basis.Double.Measures
Description : distance between Double numbers
Copyright : (c) Michal Konecny
License : BSD3
Maintainer : mikkonecny@gmail.com
Stability : experi... | michalkonecny/aern | aern-double/src/Numeric/AERN/RealArithmetic/Basis/Double/Measures.hs | Haskell | bsd-3-clause | 1,576 |
{- |
Module : <Onping.Tag.Report>
Description : <Executable for Onping Tag Report >
Copyright : (c) <Plow Technology 2014>
License : <MIT>
Maintainer : <lingpo.huang@plowtech.net>
Stability : unstable
Portability : portable
<Grab a company by its name and generate reports for all its sites , loca... | plow-technologies/onping-tag-report | src/Onping/Tag/Report.hs | Haskell | bsd-3-clause | 10,288 |
module AI.MDP.GridWorld
(
GridWorld
,GridVal
,GridAction(..)
-- Debug/Visualization Funcs
,showRewards
,showAbsorbs
,showTransition
-- common action results
,deterministicActions
,maybeActions
,maybeReverseActions
,scatterActions
,BlockedCells
,MoveCost
,gridWorld
,reward
,absorb
,initVals
,iterVals
) where
impor... | chetant/mdp | AI/MDP/GridWorld.hs | Haskell | bsd-3-clause | 7,273 |
{-# LANGUAGE OverloadedStrings, DeriveDataTypeable , NoMonomorphismRestriction #-}
import MFlow.Wai.Blaze.Html.All hiding (footer, retry, push)
import qualified MFlow.Wai.Blaze.Html.All as MF(retry)
import Control.Monad.Trans
import Data.Monoid
import Control.Applicative
import Control.Concurrent
import Control.... | agocorona/MFlow | tests/workflow1.hs | Haskell | bsd-3-clause | 8,659 |
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
module Network.Mail.Locutoria.State where
import Control.Applicative ((<$>), pure)
import Control.Lens hiding (Index)
import Data.Default (def)
import Data.List (elemIndex, find)
import Data.Maybe (ca... | hallettj/locutoria | Network/Mail/Locutoria/State.hs | Haskell | bsd-3-clause | 4,908 |
module Base (
-- * General utilities
module Control.Applicative,
module Control.Monad.Extra,
module Data.List.Extra,
module Data.Maybe,
module Data.Semigroup,
module Hadrian.Utilities,
-- * Shake
module Development.Shake,
module Development.Shake.Classes,
module Development.... | bgamari/shaking-up-ghc | src/Base.hs | Haskell | bsd-3-clause | 4,129 |
{-# LANGUAGE RecordWildCards #-}
module Plot.Gauss where
import Types
import PatternRecogn.Gauss.Utils
import PatternRecogn.Utils
import PatternRecogn.Lina as Lina
import PatternRecogn.Gauss.Types
import Graphics.Rendering.Chart.Easy as Chart hiding( Matrix, Vector )
import Graphics.Rendering.Chart.Backend.Diagrams ... | EsGeh/pattern-recognition | test/Plot/Gauss.hs | Haskell | bsd-3-clause | 2,710 |
module Test.Database.Redis.CommandTests (
commandTests
) where
import Database.Redis
import Test.HUnit
import Test.Util
-- ---------------------------------------------------------------------------
-- Tests
--
commandTests :: Test
commandTests = TestLabel "command" $
TestList [ -- * Connection
... | brandur/redis-haskell | testsuite/tests/Test/Database/Redis/CommandTests.hs | Haskell | bsd-3-clause | 4,277 |
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeOperators #-}
-----------------------------------------------------------------------------
-- |
-- Copyright : Andrew Martin
-- License : BSD-style (see the file LICENSE)
--
-- Maintainer : Andrew Martin <andrew.thaddeus@gmail.com>
-- Stability : experiment... | andrewthad/vinyl-vectors | src/Data/Vector/Vinyl/Default/Empty/Monomorphic/Implication.hs | Haskell | bsd-3-clause | 2,047 |
{-# LANGUAGE ScopedTypeVariables, RankNTypes #-}
-- | Simple lenses (from SPJ's talk about lenses) - playground
module Sky.Lens.SimpleLens where
import Data.Functor.Identity
import Control.Applicative (Const(Const,getConst))
data LensR s a = LensR { getR :: s -> a, setR :: a -> s -> s }
type Lens' s a = forall f. ... | xicesky/sky-haskell-playground | src/Sky/Lens/SimpleLens.hs | Haskell | bsd-3-clause | 1,998 |
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE Safe #-}
module Data.MessagePack.Result where
import Control.Applicative (Alternative (..), Applicative (..),
(<$>), (<*>))
impo... | SX91/msgpack-haskell | src/Data/MessagePack/Result.hs | Haskell | bsd-3-clause | 1,153 |
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
module HipChat.AddOn.Types.RoomEvent where
import Control.Lens.AsText (AsText)
import qualified Control.Lens.AsText as AsText
import Data.Aeson (FromJSON, ToJSON, parseJSON, toJSON)
data RoomEvent
= RoomArchived
| ... | mjhopkins/hipchat | src/HipChat/AddOn/Types/RoomEvent.hs | Haskell | bsd-3-clause | 1,566 |
-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree. An additional grant
-- of patent rights can be found in the PATENTS file in the same directory.
{-# LANGUAGE Over... | rfranek/duckling | Duckling/Quantity/FR/Corpus.hs | Haskell | bsd-3-clause | 954 |
-- |A simple msgpack remote procedure call (rpc) system for
-- interacting with the MSF server.
module RPC.SimpleRPC (request) where
import MsgPack
import Data.Char
import Data.Maybe
import Network.HTTP (simpleHTTP)
import Network.HTTP.Base (Request (..), Response (..), RequestMethod (..))
import Network.HTTP.Headers... | GaloisInc/msf-haskell | src/RPC/SimpleRPC.hs | Haskell | bsd-3-clause | 1,716 |
{-# LANGUAGE OverloadedStrings, QuasiQuotes #-}
module Transformations.Optimising.CaseCopyPropagationSpec where
import Transformations.Optimising.CaseCopyPropagation
import Transformations.Names (ExpChanges(..))
import Test.Hspec
import Grin.TH
import Test.Test hiding (newVar)
import Test.Assertions
import Grin.TypeE... | andorp/grin | grin/test/Transformations/Optimising/CaseCopyPropagationSpec.hs | Haskell | bsd-3-clause | 10,010 |
{-# LANGUAGE CPP, NamedFieldPuns, RecordWildCards #-}
-- | cabal-install CLI command: freeze
--
module Distribution.Client.CmdFreeze (
freezeCommand,
freezeAction,
) where
import Distribution.Client.ProjectPlanning
import Distribution.Client.ProjectConfig
( ProjectConfig(..), ProjectConfigShared(..... | sopvop/cabal | cabal-install/Distribution/Client/CmdFreeze.hs | Haskell | bsd-3-clause | 8,028 |
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE AllowAmbiguousTypes ... | sleexyz/haskell-fun | TypeSafePrintF.hs | Haskell | bsd-3-clause | 3,196 |
module Main where
import Test.Tasty
import Test.Tasty.HUnit
-- import qualified TicTacToeTest as TTTT
-- import qualified GameOfLifeTest as GOL
-- import qualified HearthstoneTest as HT
-- import qualified RomanNumeralTest as RN
import qualified PokerHandsTest as PH
import qualified PokerHoldEmTest as PHT
main :: IO ... | steveshogren/haskell-katas | test/MainTest.hs | Haskell | bsd-3-clause | 600 |
module Y2017.Day09 (answer1, answer2) where
import Data.Functor
import Data.Void
import Data.Text (Text)
import qualified Data.Text as T
import qualified Data.Text.IO as T
import Text.Megaparsec
import Text.Megaparsec.Char
type Parser = Parsec Void Text
answer1, answer2 :: IO ()
answer1 = parseInput >>= print . st... | geekingfrog/advent-of-code | src/Y2017/Day09.hs | Haskell | bsd-3-clause | 1,270 |
----------------------------------------------------------------------------
-- |
-- Module : Haskell.Language.Server.Tags.Types.Imports
-- Copyright : (c) Sergey Vinokurov 2018
-- License : BSD3-style (see LICENSE)
-- Maintainer : serg.foo@gmail.com
-----------------------------------------------------... | sergv/tags-server | src/Haskell/Language/Server/Tags/Types/Imports.hs | Haskell | bsd-3-clause | 8,319 |
-----------------------------------------------------------------------------
-- Pred: Predicates
--
-- Part of `Typing Haskell in Haskell', version of November 23, 2000
-- Copyright (c) Mark P Jones and the Oregon Graduate Institute
-- of Science and Technology, 1999-2000
--
-- This program is distributed as... | elben/typing-haskell-in-haskell | Pred.hs | Haskell | bsd-3-clause | 6,679 |
{-# LANGUAGE OverloadedStrings #-}
-- | Add <http://www.w3.org/TR/cors/ CORS> (cross-origin resource sharing)
-- headers to a Snap application. CORS headers can be added either conditionally
-- or unconditionally to the entire site, or you can apply CORS headers to a
-- single route.
module CORS
(
-- * Applying CO... | GaloisInc/verification-game | web-prover/src/CORS.hs | Haskell | bsd-3-clause | 10,675 |
-- Min Zhang
-- March 2, 2016
-- LongestAlignment
-- BLAST algorithm
-- Find longest strech of matching
-- random generation sequences that match the probability
-- Not working yet
seq1 = [0, -1, -2, -1, -2, -1, -2, -1, 0, 1, 0, -1, -2, -3, -4]
value = fst
pos = snd
f [] (a, b, c, d) = (a, b, c, d)
f (x:xs) (... | Min-/HaskellSandbox | src/LongestAlignment.hs | Haskell | bsd-3-clause | 650 |
module ActorQueue where
import Control.Category
import Control.Lens
import qualified Data.Dequeue as DQ
import Prelude hiding (Either(..), id, (.))
import Entity
type ActorQueue = DQ.BankersDequeue EntityRef
dropFront :: ActorQueue -> ActorQueue
dropFront queue =
case DQ.popFront queue of
Nothing -> DQ.e... | fros1y/umbral | src/ActorQueue.hs | Haskell | bsd-3-clause | 1,010 |
{-# LANGUAGE ScopedTypeVariables #-}
{-# OPTIONS_GHC -fplugin Brisk.Plugin #-}
{-# OPTIONS_GHC -fplugin-opt Brisk.Plugin:main #-}
module Scratch where
import Control.Distributed.Process
main :: Process ()
main = do me <- getSelfPid
spawnLocal $ send me ()
expect
| abakst/brisk-prelude | examples/spawn01.hs | Haskell | bsd-3-clause | 285 |
-- Quantities
-- Copyright (C) 2015-2016 Moritz Schulte <mtesseract@silverratio.net>
-- API is not necessarily stable.
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
module Quantities.Parser
( parseNumber
, parseFraction
, parseInt
, parseDecimal
, parseMixed... | mtesseract/quantities | src/Quantities/Parser.hs | Haskell | bsd-3-clause | 3,083 |
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE CPP #-}
module Common where
import Data.Proxy
import Servant.API
#if MIN_VERSION_servant(0,10,0)
import Servant.Utils.Links
#endif
import Miso
import Miso.String
data Model = Model { modelUri :: URI, modelMsg :: String }
deriving (Show, Eq)
data Action
= ServerMs... | dmjio/miso | examples/sse/shared/Common.hs | Haskell | bsd-3-clause | 1,030 |
module Tests.Twitch.Path where
import Test.Hspec
tests :: Spec
tests = return () | menelaos/twitch | tests/Tests/Twitch/Path.hs | Haskell | mit | 81 |
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
-----------------------------------------------------------------------------
-- |
-- Copyright : (C) 2013-15 Edward Kmett
-- License : BSD-style (see the file LICENSE)
-- Maintainer : Edwar... | Gabriel439/succinct | src/Succinct/Internal/Word4.hs | Haskell | bsd-2-clause | 6,818 |
{-# OPTIONS_GHC -fno-implicit-prelude #-}
-----------------------------------------------------------------------------
-- |
-- Module : Foreign.Marshal
-- Copyright : (c) The FFI task force 2003
-- License : BSD-style (see the file libraries/base/LICENSE)
--
-- Maintainer : ffi@haskell.org
-- Stabilit... | FranklinChen/hugs98-plus-Sep2006 | packages/base/Foreign/Marshal.hs | Haskell | bsd-3-clause | 852 |
{-# LANGUAGE CPP #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module ServerMonad (
ServerMonad, evalServerMonad, mkServerState,
getUser,
getProtocolVersion,
getLastReadyTime, setLastReadyTime,
getUserInfo,
... | haskell/ghc-builder | server/ServerMonad.hs | Haskell | bsd-3-clause | 6,274 |
module Syntax.Env where
import Syntax.Tree (Identifier)
import Data.Map as Map
-- Keeps track of declarations at this scope, and the scope above.
-- And the type of identifiers in the environment.
data Env a = Env {
-- Declarations in the scope above. These can be overwritten.
aboveScope :: Map Identifier a,
... | BakerSmithA/Turing | src/Syntax/Env.hs | Haskell | bsd-3-clause | 1,997 |
-- |
-- Module : Console.Options
-- License : BSD-style
-- Maintainer : Vincent Hanquez <vincent@snarc.org>
-- Stability : experimental
-- Portability : Good
--
-- Options parsing using a simple DSL approach.
--
-- Using this API, your program should have the following shape:
--
-- >defaultMain $ do
-- > ... | NicolasDP/hs-cli | Console/Options.hs | Haskell | bsd-3-clause | 16,457 |
module Countries where
import Data.Function (on)
import qualified Data.Set as S
import Text.Read
import qualified Text.Read.Lex as L
import Safe
data Country = Country {
countryCode :: String
, countryName :: String
}
instance Show Country where
show (Country c _) = c
showCountry :: Country ->... | MicheleCastrovilli/EuPhBot | Bots/MusicBot/Countries.hs | Haskell | bsd-3-clause | 9,043 |
{- |
Module : Data.Convertible.Instances.Map
Copyright : Copyright (C) 2009-2011 John Goerzen
License : BSD3
Maintainer : John Goerzen <jgoerzen@complete.org>
Stability : provisional
Portability: portable
Instances to convert between Map and association list.
Copyright (C) 2009-2011 John G... | hdbc/convertible | Data/Convertible/Instances/Map.hs | Haskell | bsd-3-clause | 737 |
-- Test purpose:
-- Ensure that not using -Wcompat does not enable its warnings
-- {-# OPTIONS_GHC -Wcompat #-}
-- {-# OPTIONS_GHC -Wno-compat #-}
module WCompatWarningsNotOn where
import qualified Data.Semigroup as Semi
monadFail :: Monad m => m a
monadFail = do
Just _ <- undefined
undefined
(<>) = undefi... | shlevy/ghc | testsuite/tests/wcompat-warnings/WCompatWarningsNotOn.hs | Haskell | bsd-3-clause | 525 |
{-
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998
Bag: an unordered collection with duplicates
-}
{-# LANGUAGE ScopedTypeVariables, CPP #-}
module Bag (
Bag, -- abstract type
emptyBag, unitBag, unionBags, unionManyBags,
mapBag,
elemBag, ... | mettekou/ghc | compiler/utils/Bag.hs | Haskell | bsd-3-clause | 11,482 |
{-# LANGUAGE OverloadedStrings #-}
{-
This is a test of how the browser draws lines.
This is a second line.
This is a third.
That was a blank line above this.
@r@_Right justify
@c@_Center justify
@_Left justify
@bBold text
@iItalic text
@b@iBold Italic
@fFixed width
@f@bBold Fixed
@f@iItalic Fixed
@f@i@bBold Italic ... | deech/fltkhs-demos | src/Examples/browser.hs | Haskell | mit | 4,793 |
main = interact wordCount
where wordCount input = show (length (words input)) ++ "\n" | manhong2112/CodeColle | Haskell/WC.hs | Haskell | mit | 89 |
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TupleSections #-}
-- | Utilities for reifying simplified datatype info. It omits details
-- that aren't usually relevant to generating instances that work wi... | fpco/th-utilities | src/TH/ReifySimple.hs | Haskell | mit | 13,624 |
{-# LANGUAGE CPP #-}
module GHCJS.DOM.MediaKeyMessageEvent (
#if (defined(ghcjs_HOST_OS) && defined(USE_JAVASCRIPTFFI)) || !defined(USE_WEBKIT)
module GHCJS.DOM.JSFFI.Generated.MediaKeyMessageEvent
#else
#endif
) where
#if (defined(ghcjs_HOST_OS) && defined(USE_JAVASCRIPTFFI)) || !defined(USE_WEBKIT)
import GHCJS.D... | plow-technologies/ghcjs-dom | src/GHCJS/DOM/MediaKeyMessageEvent.hs | Haskell | mit | 373 |
import Data.Char (digitToInt)
asIntFold ('-' : s) = -1 * asIntFold s
asIntFold s = foldl (times_10) 0 (map digitToInt s)
where times_10 a b = a * 10 + b
concatFoldr a = foldr (\x y -> x ++ y) [] a
--takeCompare _ [] = ([], [])
--takeCompare _ (a: []) = ([a], [])
--takeCompare f (a: b: xs) =
-- if (f ... | gefei/learning_haskell | real_world_haskell/ch06.hs | Haskell | mit | 380 |
{-# LANGUAGE JavaScriptFFI #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
module Nauva.Client
( runClient
) where
import qualified Data.Text as T
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as A
import Data.Mono... | wereHamster/nauva | pkg/hs/nauva-native/src/Nauva/Client.hs | Haskell | mit | 13,305 |
import Control.Monad
import Data.List
factorial n = product [1..n]
powerset :: [a] -> [[a]]
powerset = filterM $ \x->[True, False]
combination :: [a] -> Int -> [[a]]
combination list k = filter (\x -> length x == k) $ powerset list
permutation :: Eq a => [a] -> [[a]]
permutation = nub . perm
where perm [] =... | jwvg0425/HaskellScratchPad | src/factorial.hs | Haskell | mit | 396 |
{-# htermination maximum :: (Ord a, Ord k) => [(Either a k)] -> (Either a k) #-}
| ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/full_haskell/Prelude_maximum_10.hs | Haskell | mit | 81 |
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# LANGUAGE OverloadedStrings, MultiParamTypeClasses #-}
module Util () where
import Data.ByteString.Builder (toLazyByteString)
import Text.Email.Validate
import Data.Text.Encoding
import Data.Aeson.Encode (encodeToByteStringBuilder)
import Data.Aeson.Types
import Happstac... | L8D/cido-api | lib/Util.hs | Haskell | mit | 1,190 |
module Main where
import PostgREST.App
import PostgREST.Config (AppConfig (..),
minimumPgVersion,
prettyVersion,
... | NikolayS/postgrest | src/PostgREST/Main.hs | Haskell | mit | 3,777 |
module Euler.E63 where
import Euler.Lib
( intLength
)
euler63 :: Int
euler63 = length $ concat $ takeWhile (not . null) $ map validNums [ 1 .. ]
validNums :: Integer -> [Integer]
validNums n = takeWhile ((== n) . intLength) $ dropWhile ((<n) . intLength) $
[ x^n
| x <- [ 1 .. ]
]
main :: IO ()
main = print $ e... | D4r1/project-euler | Euler/E63.hs | Haskell | mit | 327 |
{-# LANGUAGE CPP #-}
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE ExplicitNamespaces #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module Protolude (
-- * Base functions
module Base,
identity,
pass,
#if !MIN_VERS... | sdiehl/protolude | src/Protolude.hs | Haskell | mit | 19,454 |
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE PolyKinds #-}
{- |
Module : Data.Fix1
Description : Fixed point for types of kind (k -> *) -> k -> *
Copyright : (c) Paweł Nowak
License : MIT
Maintainer : pawel834@gmail.com
Stability : experimental
-}
module Data.Fix1 where
... | pawel-n/data-fix1 | src/Data/Fix1.hs | Haskell | mit | 2,175 |
module Alarm where
import Control.Probability
bool :: (Probability p, MonadProb p m) => p -> m p Bool
bool p = choose p True False
filterDist :: (Ord a, MonadProb p m) => (a -> Bool) -> m p a -> m p a
filterDist f m = do x <- m
condition (f x)
returning x
(>>=?) :: (Ord a, M... | chris-taylor/hs-probability-examples | Alarm.hs | Haskell | mit | 1,651 |
module P8 where
import Data.List
{-
(**) Eliminate consecutive duplicates of list elements.
If a list contains repeated elements they should be replaced with a single copy of the element.
The order of the elements should not be changed.
Example:
* (compress '(a a a a b c c a a d e e e e))
(A B C A D E)
-}
comp... | nikolaspapirniywork/99_problems | haskell/src/P8.hs | Haskell | apache-2.0 | 685 |
{-# LANGUAGE BangPatterns #-}
{-|
Module : Data.Snowflake
Description : Unique id generator. Port of Twitter Snowflake.
License : Apache 2.0
Maintainer : edofic@gmail.com
Stability : experimental
This generates unique(guaranteed) identifiers build from time stamp,
counter(inside same millisecond) and node... | edofic/snowflake-haskell | src/Data/Snowflake.hs | Haskell | apache-2.0 | 3,881 |
-- -*- coding: utf-8; -*-
module Filter where
import Model
import qualified Data.Map as Map
filterElements :: Map.Map String String -- props jakie muszą być znalezione żeby element był zwrócony
-> [Element] -- filtrowane elementy
-> [Element]
filterElements pattern (... | grzegorzbalcerek/orgmode | Filter.hs | Haskell | bsd-2-clause | 809 |
{-# LANGUAGE OverloadedStrings, ScopedTypeVariables #-}
-- | High-level API for CouchDB design documents. These methods are very
-- convenient for bootstrapping and testing.
module Database.CouchDB.Conduit.Design (
couchPutView
) where
import Prelude hiding (catch)
import Control.Monad (void)
impo... | lostbean/neo4j-conduit | src/Database/CouchDB/Conduit/Design.hs | Haskell | bsd-2-clause | 2,689 |
module GTL.Text (
gtlToText
) where
import GTL.Parser
import qualified Data.Map as Map
import Data.List ((\\), partition, sort, intercalate, foldl')
import Data.Tree
gtlToText :: MyTree -> [String]
gtlToText tree = reverse
$ concat
$ reverse
$ flatten
... | EchoTeam/gtl | tools/GTL/Text.hs | Haskell | bsd-2-clause | 993 |
-- 248155780267521
import Data.List(sort)
import Euler(digitSum)
kk = 20
nn = 10^kk-1
mm = digitSum nn
vv = 30
findPowerSums n = map fst $ filter (\x -> snd x == n) ns
where ps = takeWhile (nn>) $ map (n^) [2..]
ns = map (\x -> (x, digitSum x)) ps
allPowerSums = sort $ concatMap findPowerSums [2..mm]
... | higgsd/euler | hs/119.hs | Haskell | bsd-2-clause | 368 |
-- Exercise 5 in chapter 3 of "Real World Haskell"
isPalindrome :: (Eq a) => [a] -> Bool
isPalindrome [] = True
isPalindrome ys@(x:xs) | odd (length ys) = False
isPalindrome ys@(x:xs) | ys == (reverse ys) = True
isPalindrome (x:xs) = False
| ploverlake/practice_of_haskell | src/isPalindrome.hs | Haskell | bsd-2-clause | 299 |
module Graphics.Pastel.WX.Test ( testWX ) where
import Graphics.UI.WX hiding (circle)
import Graphics.UI.WXCore.Image
import Graphics.Pastel
import Graphics.Pastel.WX.Draw
testWX :: (Int, Int) -> Drawing -> IO ()
testWX (w,h) d = start gui
where gui = do
window <- frame [text := "Pastel WX Runner"]... | willdonnelly/pastel | Graphics/Pastel/WX/Test.hs | Haskell | bsd-3-clause | 529 |
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE NoImplicitPrelude, MagicHash #-}
{-# LANGUAGE AutoDeriveTypeable, StandaloneDeriving #-}
-----------------------------------------------------------------------------
-- |
-- Module : Control.Exception.Base
-- Copyright : (c) The University of Glasgow 2001
-- License ... | DavidAlphaFox/ghc | libraries/base/Control/Exception/Base.hs | Haskell | bsd-3-clause | 14,530 |
{-# LANGUAGE Arrows, OverloadedStrings #-}
import FRP.Yampa
import FRP.Yampa.Utilities
import Data.Colour.Names
import Graphics
import Shapes
import Input
type Scalar = Double
type Vector = (Scalar, Scalar)
type Position = (Scalar, Scalar)
main :: IO ()
main = animate "Demo" 640 480 (parseWinInput >>> ((demo >>> ren... | pyrtsa/yampa-demos-template | src/Main.hs | Haskell | bsd-3-clause | 1,890 |
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE GADTs #-}
module DodgerBlue.Types
(CustomDsl(..),
customCmd,
ConcurrentDslCmd(..),
CustomCommandStep) where
import Data.Text (Text)
import Data.Typeable
import Contr... | adbrowne/dodgerblue | src/DodgerBlue/Types.hs | Haskell | bsd-3-clause | 1,297 |
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE RankNT... | bergey/plots | src/Plots/Types/Points.hs | Haskell | bsd-3-clause | 4,812 |
{-# LANGUAGE
OverlappingInstances
,EmptyDataDecls
,FlexibleContexts
,FlexibleInstances
,FunctionalDependencies
,GeneralizedNewtypeDeriving
,KindSignatures
,MultiParamTypeClasses
,NoMonomorphismRestriction
,ScopedTypeVariables
,TemplateHaskell
,TypeOperators
,TypeSynon... | LeifW/xmonad-extras | XMonad/Config/Alt/Internal.hs | Haskell | bsd-3-clause | 12,595 |
module Bead.View.Markdown (
markdownToHtml
, serveMarkdown
) where
{- A markdown to HTML conversion. -}
import Control.Monad.IO.Class
import qualified Data.ByteString.Char8 as BS
import Data.Either
import Data.String
import Data.String.Utils (replace)
import S... | pgj/bead | src/Bead/View/Markdown.hs | Haskell | bsd-3-clause | 1,713 |
{-# LANGUAGE TemplateHaskell #-}
module UnitTest.Util.HogeTest (testSuite) where
import Test.Framework (defaultMain, Test)
import Test.Framework.Providers.QuickCheck2
import Test.Framework.TH
main = defaultMain [testSuite]
testSuite :: Test
testSuite = $(testGroupGenerator)
prop_concat :: [[Int]] -> Bool
prop_co... | hyone/haskell-unittest-project-template | src/UnitTest/Util/HogeTest.hs | Haskell | bsd-3-clause | 360 |
module System.GPIO
-- Re-exported types
( Pin(..)
, fromInt
, ActivePin
, Value(..)
, Direction
-- Exported API
, initReaderPin
, initWriterPin
, readPin
, writePin
, reattachToReaderPin
, reattachToWriterPin
, closePin
) where
import Control.Exception ... | TGOlson/gpio | lib/System/GPIO.hs | Haskell | bsd-3-clause | 3,434 |
module Tests.Development.Cake where
import qualified Tests.Development.Cake.Options
import qualified Tests.Development.Cake.Core.Types
import Test.Framework
tests =
[ testGroup "Tests.Development.Cake.Core.Types"
Tests.Development.Cake.Core.Types.tests
, testGroup "Tests.Development.Cake.Options"
... | nominolo/cake | unittests/Tests/Development/Cake.hs | Haskell | bsd-3-clause | 399 |
module Text.Icalendar (
module Text.Icalendar.Event
, module Text.Icalendar.Types
, events
, parser
) where
import Data.Maybe
import Data.Time
import Text.Parsec
import qualified Text.Parsec.ByteString as PBS
import Text.Icalendar.Event
import Text.Icalendar.Parser
import Text.Icalendar.Token
import Text.... | samstokes/icalendar-parser | Text/Icalendar.hs | Haskell | bsd-3-clause | 1,558 |
{-# LANGUAGE OverloadedStrings #-}
module Parse ( train,
test
) where
import DataPath
import qualified Data.ByteString as B
import qualified Data.Attoparsec.ByteString as P
--parsing byte file
read32BitInt :: (Num a) => B.ByteString -> a
read32BitInt b = fromInteger $ sum $ fmap (uncurr... | danielbarter/personal_website_code | blog_notebooks/Niave_Bayes_classification_MNIST/mnistclean/app/Parse.hs | Haskell | bsd-3-clause | 2,317 |
{-# LANGUAGE OverloadedStrings #-}
module API.Campbx (
feed
)
where
---------------------------------------------------------------------------------------------------
import Pipes
---------------------------------------------------------------------------------------------------
import qualified Data.By... | RobinKrom/BtcExchanges | src/API/Campbx.hs | Haskell | bsd-3-clause | 565 |
-- Copyright (c) 2015, Travis Bemann
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- o Redistributions of source code must retain the above copyright notice, this
-- list of conditio... | tabemann/amphibian | src_old/Network/IRC/Client/Amphibian/Default.hs | Haskell | bsd-3-clause | 3,985 |
-- |
-- Module : Data.CVector.Mutable
-- Copyright : (c) 2012-2013 Michal Terepeta
-- (c) 2009-2010 Roman Leshchinskiy
-- License : BSD-style
--
-- Maintainer : Michal Terepeta <michal.terepeta@gmail.com>
-- Stability : experimental
-- Portability : non-portable
--
-- Wrapper around unboxed ... | michalt/cvector | Data/CVector/Unboxed/Mutable.hs | Haskell | bsd-3-clause | 7,195 |
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
-- | This module provides the abstract domain for primitive values.
module Jat.PState.AbstrDomain
( AbstrDomain (..), mkcon)
where
import Jat.JatM
import Jat.Utils.Pretty
import Jat.Constraints (PATerm, ass)
import Data.Maybe (isJust)
... | ComputationWithBoundedResources/jat | src/Jat/PState/AbstrDomain.hs | Haskell | bsd-3-clause | 961 |
module Main where
import qualified Text.Scalar.CLI as CLI
main :: IO ()
main = CLI.main
| corajr/scalar-convert | app/Main.hs | Haskell | bsd-3-clause | 90 |
{-# LANGUAGE MultiParamTypeClasses,TemplateHaskell,QuasiQuotes #-}
module Language.XHaskell where
import Data.List (zip4,sort,nub,foldl1)
import qualified Data.Traversable as Trvsbl (mapM)
-- import Data.Generics
import Control.Monad
import qualified Language.Haskell.TH as TH
import Language.Haskell.TH.Quote
import ... | luzhuomi/xhaskell | Language/XHaskell.hs | Haskell | bsd-3-clause | 69,224 |
-- | Download and import feeds from various sources.
module HN.Model.Feeds where
import HN.Data
import HN.Monads
import HN.Model.Items
import HN.Types
import HN.Curl
import qualified HN.Model.Mailman (downloadFeed)
import Control.Applicative
import Network.URI
import Snap.App
import Text.Feed.Import
import Text.Fe... | jwaldmann/haskellnews | src/HN/Model/Feeds.hs | Haskell | bsd-3-clause | 6,761 |
{-# LINE 1 "System.Environment.ExecutablePath.hsc" #-}
{-# LANGUAGE Safe #-}
{-# LINE 2 "System.Environment.ExecutablePath.hsc" #-}
{-# LANGUAGE CPP #-}
-----------------------------------------------------------------------------
-- |
-- Module : System.Environment.ExecutablePath
-- Copyright : (c) The Unive... | phischu/fragnix | builtins/base/System.Environment.ExecutablePath.hs | Haskell | bsd-3-clause | 2,382 |
-- | This module provides functionality for retrieving and parsing the
-- quantum random number data from the Australian National University QRN server.
--
-- This module can be used when one only wants to use live data directly from the server,
-- without using any of the data store functionality.
--
-- In mos... | BlackBrane/quantum-random-numbers | src-lib/Quantum/Random/ANU.hs | Haskell | mit | 1,737 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.