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 |
|---|---|---|---|---|---|
-- TODO this parser is wonky
module Parse where
data Parser a = P {runParser :: String -> [(a, String)]}
first f (a, b) = (f a , b)
instance Functor Parser where
fmap f p = P $ map (first f) . runParser p
instance Applicative Parser where
pure = return
f <*> x = do
f <- f
x <- x
return $ f x
instanc... | kovach/cards | src/Parse.hs | Haskell | mit | 4,510 |
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Data.ByteString (ByteString)
import qualified Data.ByteString.Char8 as BC
import Data.Time
import Data.Word
import Test.Tasty
import Test.Tasty.HUnit
-- IUT
import Data.OTP
hotpSecret :: By... | matshch/OTP | test/Test.hs | Haskell | mit | 2,655 |
module Data.FacetedSpec where
import Control.Applicative
import Data.Faceted
import Test.Hspec
-- Simple Faceted Value
simple = (\x -> x > 0) ? 1 .: 0
nested = (\x -> x <= 2) ?? ((\x -> x < 2) ? 1 .: 2) .: ((\x -> x < 4 ) ? 3 .: 4)
-- do syntax test cases
ap_do = do a <- ((\x -> 0 < x && x < 3) ? 1 .: 2)
b... | everpeace/faceted-values | test/Data/FacetedSpec.hs | Haskell | mit | 5,471 |
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
-- | This is a Haskell port of the Hashids library by Ivan Akimov.
-- This is /not/ a cryptographic hashing algorithm. Hashids is typically
-- used to encode numbers to a format suitable for appearance in places
-- like urls.
--
-- See the off... | tmcgilchrist/hashids-haskell | Web/Hashids.hs | Haskell | mit | 16,507 |
module Graphics.UI.FLTK.LowLevel.FLTKHS
(
-- * Motivation
--
-- $Motivation
-- * Goals
--
-- $Goals
-- * Look And Feel
--
-- $LookAndFeel
-- * Obstacles
--
-- $Obstacles
-- * Installation #Ins... | deech/fltkhs | src/Graphics/UI/FLTK/LowLevel/FLTKHS.hs | Haskell | mit | 61,697 |
{-# LANGUAGE DeriveGeneric, TypeSynonymInstances, TypeOperators,
FlexibleInstances, FlexibleContexts, OverlappingInstances #-}
module Network.Google.ApiIO.GenericParams where
import Control.Applicative ((<*>), (<$>), (<|>), pure)
import GHC.Generics
import Data.DList (DList, toList, empty)
import Data... | georgeee/haskell-google-apiIO | Network/Google/ApiIO/GenericParams.hs | Haskell | mit | 2,402 |
-- Web API part of the code
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeOperators #-}
module Star... | j3camero/galaxyatlas | OldCrap/haskell/server/src/StarServer.hs | Haskell | mit | 3,731 |
module Doppler.Tag.Syntax (
parseTag
) where
import Doppler.Tag.Types
import Text.Parsec
import Text.Parsec.String (Parser)
import Control.Monad (void)
-- Generic tag structure parser.
parseTag :: Monoid v =>
Parser TagName ->
-- ^ Parser for tag names.
Parser k ->
... | oinuar/doppler-html | src/Doppler/Tag/Syntax.hs | Haskell | mit | 2,690 |
import Data.Digest.SHA2
import qualified Data.ByteString as B
import System.IO
doManyHashes :: Int -> IO Bool
doManyHashes 0 = do
return True
doManyHashes counter = do
contents <- B.readFile "/tmp/data.0512"
-- let contentsWord8 = B.unpack contents
let hash = sha256 $ B.unpack contents
-- let oct... | adizere/nifty-tree | playground/sha2-dd.hs | Haskell | mit | 486 |
module Syntax_Test where
-- see: https://leiffrenzel.de/papers/getting-started-with-hunit.html
import Test.HUnit
import Syntax
-- The structure of a test case is always this:
-- 1. create some input,
-- 2. run the tested code on that input,
-- 3. make some assertions over the results.
-- 4. group them by test lists,... | dnvriend/study-category-theory | haskell/learn_a_haskell/ch4/Syntax_Test.hs | Haskell | apache-2.0 | 1,040 |
module Poset.A334231Spec (main, spec) where
import Test.Hspec
import Poset.A334231 (a334231)
main :: IO ()
main = hspec spec
spec :: Spec
spec = describe "A334231" $
it "correctly computes the first 20 elements" $
map a334231 [1..20] `shouldBe` expectedValue where
expectedValue = [1,2,2,3,3,3,4,4,6,4,5,5,... | peterokagey/haskellOEIS | test/Poset/A334231Spec.hs | Haskell | apache-2.0 | 339 |
{-# OPTIONS -fglasgow-exts #-}
-----------------------------------------------------------------------------
{-| Module : QStyleOptionTab.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 - ... | uduki/hsQt | Qtc/Enums/Gui/QStyleOptionTab.hs | Haskell | bsd-2-clause | 12,522 |
-- | Settings are centralized, as much as possible, into this file. This
-- includes database connection settings, static file locations, etc.
-- In addition, you can configure a number of different aspects of Yesod
-- by overriding methods in the Yesod typeclass. That instance is
-- declared in the Foundation.hs file.... | konn/Yablog | Settings.hs | Haskell | bsd-2-clause | 3,325 |
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE PatternGuards #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE EmptyDataDecls #-}
{-# LANG... | haskell-distributed/distributed-process-platform | src/Control/Distributed/Process/Platform/Execution/Exchange/Router.hs | Haskell | bsd-3-clause | 9,019 |
{-------------------------------------------------------------------------------
DSem.VectorSpace
Vector space model interface
(c) 2013 Jan Snajder <jan.snajder@fer.hr>
-------------------------------------------------------------------------------}
{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, Fle... | jsnajder/dsem | src/DSem/VectorSpace.hs | Haskell | bsd-3-clause | 2,231 |
module Main where
import Multiarg.Examples.Grover
import System.Environment
main :: IO ()
main = do
as <- getArgs
putStrLn . show $ parseGrover as
| massysett/multiarg | tests/grover-main.hs | Haskell | bsd-3-clause | 153 |
{-
(c) The University of Glasgow, 2004-2006
Module
~~~~~~~~~~
Simply the name of a module, represented as a FastString.
These are Uniquable, hence we can build Maps with Modules as
the keys.
-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE RecordWildCards #-}
module Module
(
-- * The ModuleName type
... | GaloisInc/halvm-ghc | compiler/basicTypes/Module.hs | Haskell | bsd-3-clause | 23,424 |
module Graphics.Renderer where
import Graphics.Types
import Graphics.QuadRenderer
import Graphics.TextRenderer
import Graphics.Rendering.OpenGL
import Data.List (intercalate)
printGraphicStats :: IO ()
printGraphicStats = do
-- Display some info about opengl
... | schell/blocks | src/Graphics/Renderer.hs | Haskell | bsd-3-clause | 1,351 |
-- Copyright (c) 2012, Christoph Pohl
-- BSD License (see http://www.opensource.org/licenses/BSD-3-Clause)
-------------------------------------------------------------------------------
--
-- Project Euler Problem 6
--
-- The sum of the squares of the first ten natural numbers is,
-- 1² + 2² + ... + 10² = 385
--
-- Th... | Psirus/euler | src/euler006.hs | Haskell | bsd-3-clause | 856 |
{-# LANGUAGE DeriveGeneric #-}
module Package (Package(..)) where
import GHC.Generics
import qualified Data.Yaml as Yaml
import Description
data Package = Package
{ version :: String
-- , description :: Description
}
deriving (Show, Generic)
instance Yaml.FromJSON Package
| angerman/stackage2nix | src/Package.hs | Haskell | bsd-3-clause | 284 |
module Data.Shapefile.Types where
| tolysz/shapefile2json | src/Data/Shapefile/Types.hs | Haskell | bsd-3-clause | 35 |
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
module Test.Golden where
import Prelude ()
import Prelude.Compat
import Control.Exception (try)
import Control.Lens ((&), (.~))
import Control.Monad.IO.Class (MonadIO)
import Data.ByteString (ByteString)
import Data.ByteString.Lazy (fromStrict)
import qu... | cdepillabout/highlight | test/Test/Golden.hs | Haskell | bsd-3-clause | 10,201 |
{-# LANGUAGE OverloadedStrings #-}
import TPG.WebAPI
import TPG.Structured
import System.Directory
import System.Environment
import System.IO
import qualified Data.ByteString.Lazy as BS
import Cfg
import Control.Monad
import Control.Monad.Loops
import Data.Either
getDepartureList :: String -> [([String],[Thermometer])... | sebug/tpg_sandbox | from_to.hs | Haskell | bsd-3-clause | 4,601 |
module Market.Board
( module Market.Board.Types
) where
import Market.Board.Types
| s9gf4ult/market | Market/Board.hs | Haskell | bsd-3-clause | 97 |
{-# LANGUAGE DeriveFunctor, DeriveFoldable, DeriveTraversable #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Language.Angler.ScopedTable
( ScopedTable, Scope
, tab_stack
-- basic
, emptyScope, emptyWithIndefinable, empty
, lookup , elem, elemInCurrentScope
, insertWith... | angler-lang/angler-lang | src/Language/Angler/ScopedTable.hs | Haskell | bsd-3-clause | 4,239 |
-----------------------------------------------------------------------------
-- |
-- Module : HJScript.DOM
-- Copyright : (c) Joel Bjornson 2008
-- License : BSD-style
-- Maintainer : Joel Bjornson joel.bjornson@gmail.com
-- Niklas Broberg nibro@cs.chalmers.se
-- Stability : experimen... | seereason/HJScript | src/HJScript/DOM.hs | Haskell | bsd-3-clause | 968 |
module Main where
import Control.Exception (bracket)
import Data.Time.Clock.POSIX (POSIXTime, getPOSIXTime)
import qualified Data.Map as Map
import qualified Data.Vector as Vector
import Minecraft.Anvil (ChunkX, ChunkZ, ChunkData, ChunkMap, compressChunkData, writeChunkMap)
import Minecraft.Core (BlockId(..), toNBT)
i... | stepcut/minecraft-data | utils/GenWorld.hs | Haskell | bsd-3-clause | 915 |
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
--
-- Copyright © 2013-2015 Anchor Systems, Pty Ltd and Othe... | anchor/ceilometer-common | lib/Ceilometer/Client.hs | Haskell | bsd-3-clause | 4,830 |
{-# LANGUAGE PatternSynonyms #-}
--------------------------------------------------------------------------------
-- |
-- Module : Graphics.GL.ARB.DrawBuffers
-- Copyright : (c) Sven Panne 2019
-- License : BSD3
--
-- Maintainer : Sven Panne <svenpanne@gmail.com>
-- Stability : stable
-- Portability ... | haskell-opengl/OpenGLRaw | src/Graphics/GL/ARB/DrawBuffers.hs | Haskell | bsd-3-clause | 1,214 |
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
-- |
-- Module : Pact.Types.Runtime
-- Copyright : (C) 2019 Stuart Popejoy
-- License : BSD-style (see the file LICENSE)
-- Mai... | kadena-io/pact | src/Pact/Types/ChainMeta.hs | Haskell | bsd-3-clause | 5,386 |
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE... | input-output-hk/pos-haskell-prototype | faucet/src/Cardano/Faucet/Types/Recaptcha.hs | Haskell | mit | 3,617 |
f x = y 0
where y z | z > 10 = 10
| otherwise = (10 + 20)
q = 20
p = 10
| itchyny/vim-haskell-indent | test/where/where_paren.in.hs | Haskell | mit | 73 |
{-| Definition of the data collectors used by MonD.
-}
{-
Copyright (C) 2014 Google Inc.
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 copyri... | dimara/ganeti | src/Ganeti/DataCollectors.hs | Haskell | bsd-2-clause | 3,774 |
{-# LANGUAGE BangPatterns #-}
-- | In-place quicksort.
module QuickSort (quickSort) where
import Control.Monad
import Control.Monad.Primitive
import Control.Monad.ST
import Data.List (sort)
import Data.Vector (Vector)
import qualified Data.Vector as V (toList)
import... | QuinnSurkamer/sorting | src/Quicksort.hs | Haskell | bsd-3-clause | 3,850 |
module Distribution.Solver.Modular.Explore
( backjump
, backjumpAndExplore
) where
import Data.Foldable as F
import Data.List as L (foldl')
import Data.Map as M
import Distribution.Solver.Modular.Assignment
import Distribution.Solver.Modular.Dependency
import Distribution.Solver.Modular.Log
import Distrib... | kolmodin/cabal | cabal-install/Distribution/Solver/Modular/Explore.hs | Haskell | bsd-3-clause | 7,516 |
{- | Client inner-loop
This function is generally only needed if you are adding a new communication channel.
-}
processRemoteState :: IsAcidic st =>
IO CommChannel -- ^ (re-)connect function
-> IO (AcidState st)
processRemoteState reconnect
= do cmdQueue <- atomicall... | bitemyapp/apply-refact | tests/examples/Remote.hs | Haskell | bsd-3-clause | 5,693 |
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE BangPatterns #-}
module Network.Wai.Handler.Warp.ResponseHeader (composeHeader) where
import Control.Monad
import Data.ByteString (ByteString)
import qualified Data.ByteString as S
import Data.ByteString.Internal (create)
import qualified Data.CaseInsensitive as CI
impo... | frontrowed/wai | warp/Network/Wai/Handler/Warp/ResponseHeader.hs | Haskell | mit | 2,513 |
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE CPP, NoImplicitPrelude, MagicHash, UnboxedTuples #-}
-----------------------------------------------------------------------------
-- |
-- Module : Data.IORef
-- Copyright : (c) The University of Glasgow 2001
-- License : BSD-style (see the file libraries/base/LI... | jtojnar/haste-compiler | libraries/ghc-7.10/base/Data/IORef.hs | Haskell | bsd-3-clause | 5,368 |
module Q2 where
import Q
instance Show (IO a) where
show = undefined
| olsner/ghc | testsuite/tests/cabal/T12733/q/Q2.hs | Haskell | bsd-3-clause | 73 |
-----------------------------------------------------------------------------
-- |
-- Module : Data.AFSM.Auto
-- Copyright : (c) Hanzhong Xu, Meng Meng 2016,
-- License : MIT License
--
-- Maintainer : hanzh.xu@gmail.com
-- Stability : experimental
-- Portability : portable
-------------------------... | PseudoPower/AFSM | src/Data/AFSM/Auto.hs | Haskell | mit | 1,629 |
module ReplacementExperiment where
replaceWithP :: b -> Char
replaceWithP = const 'p'
lms :: [Maybe [Char]]
lms = [Just "Ave", Nothing, Just "woohoo"]
-- Just making the argument more specific
replaceWithP' :: [Maybe [Char]] -> Char
replaceWithP' = replaceWithP
liftedReplace :: Functor f => f a -> f Char
liftedRe... | NickAger/LearningHaskell | HaskellProgrammingFromFirstPrinciples/Chapter16.hsproj/ReplacementExperiment.hs | Haskell | mit | 1,333 |
{-# LANGUAGE ConstraintKinds, DataKinds, DefaultSignatures, FlexibleContexts,
FlexibleInstances, MultiParamTypeClasses, OverlappingInstances,
RankNTypes, ScopedTypeVariables, TupleSections, TypeFamilies,
TypeOperators, UndecidableInstances #-}
{- |
Module : Control.Monad.... | ivan-m/monad-levels | Control/Monad/Levels/Definitions.hs | Haskell | mit | 18,679 |
{-|
Description : Parse string into parse tree
Parsec applicative style.
-}
module Uroboro.Parser
(
-- * Parsing Uroboro
parseFile
, parseExpression
, parse
-- * Individual parsers
, parseDef
, parseExp
, Parser
, pq
) where
import Control.Applicative ((<*>), (*>))
im... | lordxist/uroboro | src/Uroboro/Parser.hs | Haskell | mit | 3,798 |
-- N-Point Crossover
-- http://www.codewars.com/kata/57339a5226196a7f90001bcf
module Kata.NPointCrossover where
import Data.List (nub, sort)
import Data.Tuple (swap)
import Control.Arrow ((***))
crossover :: [Int] -> [a] -> [a] -> ([a],[a])
crossover ns xs = unzip . f (nub . sort $ ns) 0 . zip xs
where f [] i ps... | gafiatulin/codewars | src/6 kyu/NPointCrossover.hs | Haskell | mit | 494 |
module Thirty where
import Control.Exception
data NotDivThree =
NotDivThree Int
deriving (Eq, Show)
instance Exception NotDivThree
data NotEven =
NotEven Int
deriving (Eq, Show)
instance Exception NotEven
evenAndThreeDiv :: Int -> IO Int
evenAndThreeDiv i
| rem i 3 /= 0 = throwIO (NotDivThree i)
| odd... | mudphone/HaskellBook | src/Thirty.hs | Haskell | mit | 598 |
{-# LANGUAGE OverloadedStrings #-}
module Moz.Linkscape.URLMetrics
( URLMetrics(..)
, URLMetricCol(..)
, sumUrlMetricCols
) where
import Data.Aeson (FromJSON(..), Value(..), (.:?))
import Control.Monad (mzero)
data URLMetricCol = Title
| CanoncialURL
| Subdomain
... | ags/hs-moz | src/Moz/Linkscape/URLMetrics.hs | Haskell | mit | 10,120 |
module BuiltInFunctions where
myOr :: [Bool] -> Bool
myOr = foldr (||) False
myAny :: (a -> Bool) -> [a] -> Bool
myAny f list = myOr $ map f list
myElem :: Eq a => a -> [a] -> Bool
-- myElem item = myAny (== item)
myElem item list = foldr (||) False $ map (== item) list
myReverse :: [... | mikegehard/haskellBookExercises | chapter10/BuiltInFunctions.hs | Haskell | mit | 588 |
module Handler.GamesJsonSpec (spec) where
import TestImport
spec :: Spec
spec = withApp $ do
describe "getGamesJsonR" $ do
error "Spec not implemented: getGamesJsonR"
| jabaraster/minibas-web | test/Handler/GamesJsonSpec.hs | Haskell | mit | 183 |
import Prelude hiding (lookup)
import Control.Monad.ST
import Data.HashTable.ST.Basic
-- Hashtable parameterized by ST "thread"
type HT s = HashTable s String String
example1 :: ST s (HT s)
example1 = do
ht <- new
insert ht "key" "value1"
return ht
example2 :: HT s -> ST s (Maybe String)
example2 ht = do
va... | riwsky/wiwinwlh | src/hashtables.hs | Haskell | mit | 421 |
module Maskell.Stats where
import Control.Monad
import Data.List
import Data.Maybe
test_mcmath = do
putStrLn "hello from Mcmath"
{-|
The `prank' function calculates percentile ranks of a list of floats.
prank [23.0, 20.0, 20.0, 57.0, 46.0]
-}
prank :: [Float] -> [Float]
prank arr =
map score arr
where
... | blippy/maskell | src/Maskell/Stats.hs | Haskell | mit | 1,454 |
module Nameless.Conversion where
import Named.Data
import Nameless.Data
import Data.List
type NamingContext = [Name] -- Naming context for DeBrujin, head = 0
getFree :: Expression -> NamingContext
getFree (Func b ex) = filter (b /=) (getFree ex)
getFree (Call e1 e2) = union (getFree e1) (getFree e2)
getFree (Var x) ... | mcapodici/haskelllearn | firstlang/simple/src/Nameless/Conversion.hs | Haskell | mit | 632 |
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_HADDOCK prune #-}
module System.Console.Docopt.QQ
(
-- * QuasiQuoter usage parsers
docopt
, docoptFile
) where
import qualified Data.Map as M
import System.Console.Docopt.Types
import System.Console.Docopt.QQ.Instances ()
import System.Console.Docopt.... | docopt/docopt.hs | System/Console/Docopt/QQ.hs | Haskell | mit | 2,082 |
{-# LANGUAGE RankNTypes, OverloadedStrings, DeriveDataTypeable,
ForeignFunctionInterface, JavaScriptFFI, EmptyDataDecls,
TypeFamilies, DataKinds, ScopedTypeVariables,
FlexibleContexts, FlexibleInstances, TypeSynonymInstances,
LambdaCase, MultiParamTypeClasses, DeriveG... | NewByteOrder/ghcjs-base | JavaScript/Web/XMLHttpRequest.hs | Haskell | mit | 8,721 |
{-# LANGUAGE OverloadedStrings #-}
module Domain.StatText (wordCount) where
import qualified Data.Text.Lazy as T
import Data.Function(on)
import Data.List(sortBy)
import Data.Map.Lazy (Map, empty, insertWith, assocs)
import Debug.Trace
wordCount :: T.Text -> [(T.Text, Integer)]
wordCount = count . filter specialWo... | johangirod/statext | src/server/Domain/StatText.hs | Haskell | mit | 1,445 |
module Main where
import TralaParser
import TralaLexer
import TralaLexerInternal
import Conduit
import System.Environment
main :: IO ()
main = do
filename <- head <$> getArgs
runResult <- runResourceT $ runLexerConduitFromStart $ alexInputsFromFile filename .| tralaTokens .| mapM_C (liftIO . putStrLn . show)
ei... | tilgalas/trala-lala | app/Main.hs | Haskell | mit | 365 |
{-# LANGUAGE FlexibleContexts #-}
module ZipperGalaxy
where
import Control.Monad
import qualified Data.Map as M
import Data.Maybe
import Libaddutil.Named
import Galaxy
import Utils
import qualified Data.Edison.Assoc.StandardMap as E
type GalaxyZipper a = (Galaxy a, Maybe (StarSystem a, Maybe (Star a, [Planet a])))
... | anttisalonen/starrover | src/ZipperGalaxy.hs | Haskell | mit | 4,557 |
-- | This transforms the output from ReadRawSpecFile for consumption into the
-- generator.
module Gen.Specifications
( CloudFormationSpec (..)
, specFromRaw
, PropertyType (..)
, Property (..)
, SpecType (..)
, subPropertyTypeNames
, customTypeNames
, AtomicType (..)
, ResourceType (..)
) where
i... | frontrowed/stratosphere | gen/src/Gen/Specifications.hs | Haskell | mit | 10,530 |
#!/usr/bin/env stack
{-
stack
--resolver lts-11.10
--install-ghc
runghc
--package base
--
-hide-all-packages
-}
-- Copyright 2018 Google LLC. 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.
-- Y... | polux/snippets | cps_defunc_evaluator.hs | Haskell | apache-2.0 | 2,645 |
sq x = x * x
main = print $ sq 12
| egaburov/funstuff | Haskell/BartoszBofH/2_MyFirstProgram/a.hs | Haskell | apache-2.0 | 35 |
module Main (main) where
import qualified System.Exit as Exit
import Hecate (configure, run)
main :: IO ()
main = configure >>= run >>= Exit.exitWith
| henrytill/hecate | executables/Main.hs | Haskell | apache-2.0 | 169 |
import Data.List
tab = [("black", 0, 0, 0),
("blue", 0, 0,255),
("lime", 0,255, 0),
("aqua", 0,255,255),
("red", 255, 0, 0),
("fuchsia",255, 0,255),
("yellow", 255,255, 0),
("white", 255,255,255)]
h2d x = read ("0x"++x) :: Int
ans x =
let ... | a143753/AOJ | 0176.hs | Haskell | apache-2.0 | 681 |
{-# LANGUAGE OverloadedStrings #-}
import Data.Text as T
import Data.RDF
import Data.RDF.Namespace
globalPrefix :: PrefixMappings
globalPrefix = ns_mappings []
baseURL :: Maybe BaseUrl
baseURL = Just $ BaseUrl "file://"
testURL = "file:///this/is/not/a/palindrome"
tris :: [Triple]
tris = [Triple
(unode tes... | bergey/metastic | src/TestCase.hs | Haskell | bsd-2-clause | 506 |
{-| Implementation of the RAPI client interface.
-}
{-
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 conditions are
met:
1. Redistributions of source code must re... | mbakke/ganeti | src/Ganeti/HTools/Backend/Rapi.hs | Haskell | bsd-2-clause | 10,629 |
module Cube where
import Shader
import Data.Foldable
import Foreign
import Graphics.GL
import Linear
import Mesh
import Shader
data Cube = Cube
{ cubeVAO :: VertexArrayObject
, cubeShader :: GLProgram
, cubeInde... | lukexi/wboit | test/Cube.hs | Haskell | bsd-2-clause | 5,793 |
{-# OPTIONS -XUndecidableInstances #-}
{-# OPTIONS -XTypeOperators #-}
{-# OPTIONS -XMultiParamTypeClasses #-}
{-# OPTIONS -XFunctionalDependencies #-}
{-# OPTIONS -XFlexibleInstances #-}
module Data.Real.CReal
(CReal, inject, around,
approx, approxRange, integerInterval,
Boun... | robbertkrebbers/fewdigits | Data/Real/CReal.hs | Haskell | bsd-2-clause | 13,570 |
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
{-# OPTIONS_GHC -Wno-orphans #-}
-----------------------------------------------------------------------------
-- |
-- Module : Control.Applicative.Singletons
-- Copyright : (C) 2018... | goldfirere/singletons | singletons-base/src/Control/Applicative/Singletons.hs | Haskell | bsd-3-clause | 2,271 |
{-# LANGUAGE CPP #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE TypeFamilies #-}
-- | Hides away distracting bookkeeping while lambda lifting into a 'LiftM'
-- monad.
module GHC.Stg.Lift.Monad (
decomposeStgBinding, mkStgBinding,
Env (..),
-- * #floats# Handling floats
-- $floats
Floa... | sdiehl/ghc | compiler/GHC/Stg/Lift/Monad.hs | Haskell | bsd-3-clause | 12,947 |
{-# LANGUAGE PatternSynonyms #-}
--------------------------------------------------------------------------------
-- |
-- Module : Graphics.GL.ARB.SamplerObjects
-- Copyright : (c) Sven Panne 2019
-- License : BSD3
--
-- Maintainer : Sven Panne <svenpanne@gmail.com>
-- Stability : stable
-- Portabili... | haskell-opengl/OpenGLRaw | src/Graphics/GL/ARB/SamplerObjects.hs | Haskell | bsd-3-clause | 1,024 |
module Main(main) where
import Weeder
import System.Exit
import System.Environment
import Control.Monad
main :: IO ()
main = do
bad <- weeder =<< getArgs
when (bad > 0) exitFailure
| ndmitchell/weeder | src/Main.hs | Haskell | bsd-3-clause | 191 |
{-# LANGUAGE OverloadedStrings #-}
module ElmBot (eval) where
import qualified System.IO.Silently as Sys
import qualified Environment as Env
import qualified Eval.Code as Elm
eval :: String -> IO String
eval s = fst <$> Sys.capture (run s)
run :: String -> IO ()
run s = Env.run (Env.empty "elm-make" "node") (Elm.ev... | svanderbleek/elm-bot | src/ElmBot.hs | Haskell | bsd-3-clause | 337 |
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
module NotifSpec
( spec
)
where
import Kis
import Control.Concurrent
import Control.Exception.Base
import Control.Monad
import Data.Time.Clock
import System.IO.Temp
import Test.Hspec
import qualified Data.Aeson as J
import qualifie... | lslah/kis-proto | test/NotifSpec.hs | Haskell | bsd-3-clause | 5,385 |
module Util.HTML
( Html
, Attribute
, Attributable
, renderHtml
, toHtml
, attribute
, empty
, parent
, leaf
, makeAttr
, makePar
, makeLeaf
, (!)
, ($<)
) where
import Data.Monoid
data HtmlM a
= Parent !String -- ^ Tag
!String ... | johanneshilden/liquid-epsilon | Util/HTML.hs | Haskell | bsd-3-clause | 3,029 |
{-# LANGUAGE GeneralizedNewtypeDeriving, DeriveDataTypeable, ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
module Development.Shake.Internal.Rules.Rerun(
defaultRuleRerun, alwaysRerun
) where
import Development.Shake.Internal.Core.Rules
import Development.Shake.Internal.Core.Types
import Development.S... | ndmitchell/shake | src/Development/Shake/Internal/Rules/Rerun.hs | Haskell | bsd-3-clause | 1,560 |
{-# LANGUAGE QuantifiedConstraints #-}
module Error
( Err
, runErr
, throw
, throwMany
, context
, contextShow
, fromEither
, fromEitherShow
, note
, sequenceV
, traverseV
, traverseV_
, forV
, forV_
, HasErr
, Sem
)
where
import Data.Vector as V
... | expipiplus1/vulkan | generate-new/src/Error.hs | Haskell | bsd-3-clause | 2,402 |
module Main where
import qualified Web.JWTTests
import qualified Web.JWTInteropTests
import qualified Web.Base64Tests
import qualified Data.Text.ExtendedTests
import Test.Tasty
main :: IO ()
main = defaultMain tests
tests :: TestTree
tests = testGroup "JWT Tests" [
Web.JWTTests.defaultT... | bitemyapp/haskell-jwt | tests/src/TestRunner.hs | Haskell | mit | 519 |
module Data.Kicad.PcbnewExpr
(
-- * Types
PcbnewExpr(..)
-- * Parse
, parse
, parseWithFilename
, fromSExpr
-- * Write
, pretty
, write
)
where
import Data.Kicad.PcbnewExpr.PcbnewExpr
import Data.Kicad.PcbnewExpr.Parse
import Data.Kicad.PcbnewExpr.Write
| kasbah/haskell-kicad-data | Data/Kicad/PcbnewExpr.hs | Haskell | mit | 256 |
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ViewPatterns #-}
module Acquire.Game.Player where
import Acquire.Game.Hotels
import Acquire.Game.Tiles
import Data.Aeson (FromJSON (..), ToJSON (..), Value (..),
... | abailly/hsgames | acquire/src/Acquire/Game/Player.hs | Haskell | apache-2.0 | 2,371 |
{-| Utility functions for the maintenance daemon.
-}
{-
Copyright (C) 2015 Google Inc.
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 copyrigh... | bitemyapp/ganeti | src/Ganeti/MaintD/Utils.hs | Haskell | bsd-2-clause | 2,013 |
-- |
-- Utility functions for Mailchimp
--
module Web.Mailchimp.Util
where
import Control.Monad (mzero)
import Data.Aeson (ToJSON(..), FromJSON(..), Value(..), object)
import Data.Text (pack, unpack)
import Data.Char (isAlpha, toLower, isUpper)
import Data.Time.Clock (UTCTime)
import Data.Time.Format (formatTime... | tlaitinen/mailchimp | Web/Mailchimp/Util.hs | Haskell | bsd-3-clause | 1,584 |
{-# LANGUAGE
DeriveFunctor,
DeriveFoldable,
DeriveTraversable,
NoMonomorphismRestriction,
GeneralizedNewtypeDeriving,
StandaloneDeriving,
TypeFamilies,
ViewPatterns,
MultiParamTypeClasses,
TypeSynonymInstances, -- TODO remove
FlexibleInstances,
OverloadedString... | FranklinChen/music-score | sketch/old/trans/trans.hs | Haskell | bsd-3-clause | 17,874 |
{-# LANGUAGE CPP #-}
module System.Console.CmdArgs.Explicit.Type where
import Control.Arrow
import Control.Monad
import Data.Char
import Data.List
import Data.Maybe
#if __GLASGOW_HASKELL__ < 709
import Data.Monoid
#endif
-- | A name, either the name of a flag (@--/foo/@) or the name of a mode.
type Name = String
-... | copland/cmdargs | System/Console/CmdArgs/Explicit/Type.hs | Haskell | bsd-3-clause | 10,204 |
{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# OPTIO... | ezyang/ghc | utils/ghc-pkg/Main.hs | Haskell | bsd-3-clause | 90,493 |
{-# Language FlexibleContexts, ScopedTypeVariables #-}
-- | A multitap looper.
module Csound.Air.Looper (
LoopSpec(..), LoopControl(..),
sigLoop, midiLoop, sfLoop, patchLoop
) where
import Control.Monad
import Data.List
import Data.Default
import Data.Boolean
import Csound.Typed
import Csound.Typed.Gui hiding (but... | isomorphism/csound-expression | src/Csound/Air/Looper.hs | Haskell | bsd-3-clause | 9,934 |
-- This is a modification of the calendar program described in section 4.5
-- of Bird and Wadler's ``Introduction to functional programming'', with
-- two ways of printing the calendar ... as in B+W, or like UNIX `cal':
import IO -- 1.3
import System -- 1.3
import List -- 1.3
import Char -- 1.3
-- Picture handling:
... | hvr/jhc | regress/tests/9_nofib/spectral/Calendar.hs | Haskell | mit | 4,727 |
{-# LANGUAGE BangPatterns, CPP, MagicHash, UnboxedTuples #-}
{-# OPTIONS_GHC -O #-}
-- We always optimise this, otherwise performance of a non-optimised
-- compiler is severely affected
-- -----------------------------------------------------------------------------
--
-- (c) The University of Glasgow, 1997-2006
--
--... | ryantm/ghc | compiler/utils/Encoding.hs | Haskell | bsd-3-clause | 13,525 |
-- Check that "->" is an instance of Eval
module ShouldSucceed where
instance Show (a->b) where
show _ = error "attempt to show function"
instance (Eq b) => Eq (a -> b) where
(==) f g = error "attempt to compare functions"
-- Since Eval is a superclass of Num this fails
-- unless -> is an instance of Ev... | forked-upstream-packages-for-ghcjs/ghc | testsuite/tests/typecheck/should_compile/tc088.hs | Haskell | bsd-3-clause | 715 |
-- This one killed GHC 6.4 because it bogusly attributed
-- the CPR property to the construtor T
-- Result: a mkWWcpr crash
-- Needs -prof -auto-all to show it up
module ShouldCompile where
newtype T a = T { unT :: a }
f = unT
test cs = f $ case cs of
[] -> T []
(x:xs) -> T $ test cs
| forked-upstream-packages-for-ghcjs/ghc | testsuite/tests/stranal/should_compile/newtype.hs | Haskell | bsd-3-clause | 300 |
{-# LANGUAGE Trustworthy #-}
module Check03_A (
trace
) where
import qualified Debug.Trace as D
import qualified Data.ByteString.Lazy.Char8 as BS
-- | Allowed declasification
trace :: String -> a -> a
trace s = D.trace $ s ++ show a3
a3 :: BS.ByteString
a3 = BS.take 3 $ BS.repeat 'a'
| urbanslug/ghc | testsuite/tests/safeHaskell/check/Check03_A.hs | Haskell | bsd-3-clause | 301 |
module Tests.Machine (tests) where
import Machine
import Data.Machine
import Test.Framework
import Test.Framework.Providers.QuickCheck2 (testProperty)
import Test.QuickCheck
import Test.QuickCheck.Property as Property
tests :: [Test]
tests = [ (testProperty "concatenation of result equal to input" prop_groupBy_conc... | danstiner/clod | test/Tests/Machine.hs | Haskell | mit | 1,504 |
{-|
Module : Language.Vigil.Simplify.Top
Description :
Copyright : (c) Jacob Errington and Frederic Lafrance, 2016
License : MIT
Maintainer : goto@mail.jerrington.me
Stability : experimental
Simplifications for the top-level (globals and function declarations).
-}
{-# LANGUAGE OverloadedStrings #-}
mod... | djeik/goto | libgoto/Language/Vigil/Simplify/Top.hs | Haskell | mit | 5,105 |
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PatternSynonyms #-}
module Hickory.Graphics.Shader
( loadShader,
loadShaderFromPaths,
useShader,
getAttribLocation,
UniformLoc,
retrieveLoc,
ShaderID,
Shader (..),
)
where
import Control.Monad
import qualif... | asivitz/Hickory | Hickory/Graphics/Shader.hs | Haskell | mit | 5,182 |
import Data.List
phi :: Int -> Int
phi n = product xs
where
xs = map (\(p, m) -> (p - 1) * p ^ (m - 1)) (primeFactorsMult n)
primeFactorsMult :: Int -> [(Int, Int)]
primeFactorsMult = map encoder . group . primeFactors
where
encoder xs = (head xs, length xs)
primeFactors :: Int -> [Int]
primeFactors n = pr... | curiousily/haskell-99problems | 37.hs | Haskell | mit | 870 |
-- -------------------------------------------------------------------------------------
-- Author: Sourabh S Joshi (cbrghostrider); Copyright - All rights reserved.
-- For email, run on linux (perl v5.8.5):
-- perl -e 'print pack "H*","736f75726162682e732e6a6f73686940676d61696c2e636f6d0... | cbrghostrider/Hacking | HackerRank/FunctionalProgramming/Recursion/filterElements_HashTable_fast.hs | Haskell | mit | 1,458 |
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeSynonymInstances #-}
module Firestone.Player ( drawCard
, summonMinionAt
... | Jinxit/firestone | src/Firestone/Player.hs | Haskell | mit | 870 |
module Test (
testWorldRod
, testWorldCircle
, testWorldRigidSkin
, testWorldBlob
, testWorldGrid
) where
import Data.Tuple
import Control.Monad as M
import Control.Monad.State.Lazy
import Control.Applicative
import Internal
import Vector
import Types
testWorldRod :: World
testWorldRod = exe... | ThatSnail/hs-softbody | Test.hs | Haskell | mit | 4,841 |
module Main where
import LI11718
import SimulateT6
import AnimateT6
import System.Environment
import Text.Read
main = do
animaT6 (${mapa}) (${pista}) (${frames}) (${players}) | hpacheco/HAAP | examples/plab/oracle/AnimateT6Match.hs | Haskell | mit | 182 |
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE ForeignFunctionInterface #-}
{-# LANGUAGE OverloadedStrings #-}
import Control.Monad (void)
import Data.Monoid ((<>))
import qualified Data.Vector.Storable.Mutable as V
import Foreign.C.Types
import Foreig... | fpco/inline-c | inline-c/test/tests.hs | Haskell | mit | 8,498 |
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
-- | This is a Haskell port of the Hashids library by Ivan Akimov.
-- This is /not/ a cryptographic hashing algorithm. Hashids is typically
-- used to encode numbers to a format suitable for appearance in places
-- like urls.
--
-- See the off... | jkramarz/hashids-haskell | Web/Hashids.hs | Haskell | mit | 16,464 |
-- vim: set ts=2 sw=2 sts=0 ff=unix foldmethod=indent:
module Main where
import Test.DocTest
main :: IO ()
main = doctest ["-isrc/lib", "src/cli/Main.hs"]
| eji/mix-kenall-geocode | test/doctest.hs | Haskell | mit | 159 |
module Main where
f::Int -> Int -> Int -> Int
f x1 x2 x3 = if x1 == 1
then x2
else f (x1 - 1) x3 ((x2 * x2) + (x3 * x3))
main = do x1 <- readLn
print (f x1 1 1)
| sebschrader/programmierung-ss2015 | E12/A2b.hs | Haskell | mit | 202 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.