code stringlengths 2 1.05M | repo_name stringlengths 5 101 | path stringlengths 4 991 | language stringclasses 3
values | license stringclasses 5
values | size int64 2 1.05M |
|---|---|---|---|---|---|
module Y2015.D12Spec (spec) where
{-# LANGUAGE OverloadedStrings #-}
import Y2015
import Test.Hspec
import Data.ByteString.Lazy.Char8 (pack)
spec :: Spec
spec = parallel $ do
describe "Day 12" $ do
describe "jsonSum" $ do
it "sums three-member lists" $
jsonSum (pack "[1,2,3]")... | tylerjl/adventofcode | test/Y2015/D12Spec.hs | Haskell | mit | 1,522 |
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE ScopedTypeVariables #-}
-- | Provides a dummy authentication module that simply lets a user specify
-- their identifier. This is not intended for real world use, just for
-- testi... | geraldus/yesod | yesod-auth/Yesod/Auth/Dummy.hs | Haskell | mit | 2,294 |
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeSynonymInstances #-}
module Common where
import Control.Arrow ((>>>), first, left)
import Control.Applicative
import Control.Concurrent (forkIO, killThread, threadDelay)
import Control.Concurrent.Async
import Control.Concurrent.MVar
... | Rufflewind/conplex | Common.hs | Haskell | mit | 4,561 |
-- makeBackronym
-- http://www.codewars.com/kata/55805ab490c73741b7000064/
module Codewars.Exercise.Backronym where
import Codewars.Exercise.Backronym.Dictionary (dict)
import Data.Char (toUpper)
makeBackronym :: String -> String
makeBackronym = unwords . map (dict . toUpper)
| gafiatulin/codewars | src/7 kyu/Backronym.hs | Haskell | mit | 280 |
module Tamari where
import Data.List
import Data.Maybe
import Catalan
import Bijections
rotR1 :: Tree -> [Tree]
rotR1 (B (t1 @ (B t11 t12)) t2) =
B t11 (B t12 t2) : [B t1' t2 | t1' <- rotR1 t1] ++ [B t1 t2' | t2' <- rotR1 t2]
rotR1 (B L t2) = [B L t2' | t2' <- rotR1 t2]
rotR1 _ = []
rotL1 :: Tree -> [Tree]
rotL1 (... | noamz/linlam-gos | src/Tamari.hs | Haskell | mit | 5,691 |
--Task 1
--sumProducts [[1,2,3], [4,5], [], [-2,3,0,5,1]] -> 27 -- 27 = 6 + 20 + 1 + 0
sumProducts m = sum (map product nonEmptyLists)
where nonEmptyLists = filter ( \ x -> not (null x)) m
sumProducts2 m = sum products
where products = map ( \ lst -> (foldr ( \ x res -> x*res ) 1 lst) ) m
--Task 2
--occurrenc... | pepincho/Functional-Programming | haskell/ex-4.hs | Haskell | mit | 1,678 |
-- FIXME: Depend on the not-yet-released project-template library.
{-# LANGUAGE OverloadedStrings #-}
module MultiFile where
import Control.Monad (unless)
import Control.Monad.IO.Class (MonadIO, liftIO)
import Control.Monad.Trans.Resource (runExceptionT)
import qualif... | piyush-kurur/yesod | yesod/MultiFile.hs | Haskell | mit | 3,652 |
{-# LANGUAGE MultiWayIf#-}
module Mealy where
import Data.Maybe (isJust)
import FRP.Yampa
import qualified Graphics.Gloss.Interface.IO.Game as G
import Buttons
leftmost p = (p>90)
rightmost p = (p<(-90))
centermost p = (p>(-10) && p <10)
isClick = isEvent. filterE (isJust. toYampaEvent)
moveLeft =... | santolucito/Euterpea_Projects | QuantumArt/Mealy.hs | Haskell | mit | 801 |
{-# LANGUAGE PatternSynonyms, ForeignFunctionInterface, JavaScriptFFI #-}
module GHCJS.DOM.JSFFI.Generated.MutationObserver
(js_newMutationObserver, newMutationObserver, js_observe, observe,
js_takeRecords, takeRecords, js_disconnect, disconnect,
MutationObserver, castToMutationObserver, gTypeMut... | plow-technologies/ghcjs-dom | src/GHCJS/DOM/JSFFI/Generated/MutationObserver.hs | Haskell | mit | 3,169 |
module HeronianTriangles.A305704Spec (main, spec) where
import Test.Hspec
import HeronianTriangles.A305704 (a305704)
main :: IO ()
main = hspec spec
spec :: Spec
spec = describe "A305704" $
it "correctly computes the first 20 elements" $
take 20 (map a305704 [1..]) `shouldBe` expectedValue where
expectedV... | peterokagey/haskellOEIS | test/HeronianTriangles/A305704Spec.hs | Haskell | apache-2.0 | 405 |
--
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements. See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership. The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you ma... | facebook/fbthrift | thrift/lib/hs/Thrift/Protocol/Binary.hs | Haskell | apache-2.0 | 7,761 |
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE Trustworthy #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_HADDOCK show-extensions #-}
{-|
Copyright : (C) 2013-2015, University of Twente
License : BSD2 (see the file LICENSE)
Maintainer : Christiaan Baaij <christiaan.baaij@gmail.com>
-}
module CLaSH.Sign... | Ericson2314/clash-prelude | src/CLaSH/Signal.hs | Haskell | bsd-2-clause | 4,201 |
{-# LANGUAGE OverloadedStrings #-}
module Types where
import Data.Ini
import Data.List (group, sort, sortOn)
import Data.Maybe (mapMaybe, listToMaybe)
import Data.Ord (Down(Down))
import Data.Text (Text, unpack)
import Data.Time.Calendar (Day)
import Text.XmlHtml (Document)
type File = (FilePath, Text)
data Blog... | kqr/two-wrongs-st | src/Types.hs | Haskell | bsd-2-clause | 2,105 |
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-| Unittests for @xm list --long@ parser -}
{-
Copyright (C) 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... | apyrgio/snf-ganeti | test/hs/Test/Ganeti/Hypervisor/Xen/XmParser.hs | Haskell | bsd-2-clause | 7,773 |
module Data.Iteratee (
module Data.Iteratee.Base
, module Data.Iteratee.Exception
, module Data.Iteratee.IO
) where
------------------------------------------------------------------------
-- Imports
------------------------------------------------------------------------
import Data.Iteratee.Base
import Data.Itera... | tanimoto/iteratee | src/Data/Iteratee.hs | Haskell | bsd-3-clause | 357 |
-- 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.
{-# LANGUAGE OverloadedStrings #-}
module Duckling.Ordinal.PT.Corpus
( corpus
) where
import Data.String
im... | facebookincubator/duckling | Duckling/Ordinal/PT/Corpus.hs | Haskell | bsd-3-clause | 2,204 |
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Test.Concurrent where
import qualified Test.Hspec as HS
import qualified Test.Hspec.QuickCheck as HS
import qualified Test.QuickCheck as Q
import qualified Control.Concurrent as CC
import qualified Control.Concurr... | asakamirai/kazura-queue | test/Test/Concurrent.hs | Haskell | bsd-3-clause | 5,114 |
{-# LANGUAGE Arrows, NoMonomorphismRestriction #-}
module AtomTestCases where
import Text.XML.HXT.Core
import Data.Tree.NTree.TypeDefs(NTree)
import Web.HRSS.Data.Atom
import Test.Framework as TF (testGroup, Test)
import Test.Framework.Providers.QuickCheck2 (testProperty)
xmlAtom0 :: [Char]
xmlAtom0 = "\
\<?xml ... | kdridi/hrss | src/test/AtomTestCases.hs | Haskell | bsd-3-clause | 5,484 |
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUA... | vigoo/stack | src/Stack/Config.hs | Haskell | bsd-3-clause | 27,563 |
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE EmptyDataDecls #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TemplateHaskell #-}
module Diagrams.TwoD.Path.Metafont.Types where
import Control.Lens hiding (( # ))
#if __GLASGOW_HASKELL__ < ... | diagrams/diagrams-contrib | src/Diagrams/TwoD/Path/Metafont/Types.hs | Haskell | bsd-3-clause | 4,322 |
--
-- Copyright © 2013-2015 Anchor Systems, Pty Ltd and Others
--
-- The code in this file, and the program it is a part of, is
-- made available to you by its authors as open source software:
-- you can redistribute it and/or modify it under the terms of
-- the 3-clause BSD licence.
--
{-# LANGUAGE TupleSections #-}
... | olorin/git-vogue | lib/Git/Vogue/PluginCommon.hs | Haskell | bsd-3-clause | 7,195 |
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
module Servant.Servant.Db
( PackageDB(..)
, AddPackageIfMissing
, GetPackage
) where
import Con... | jkarni/servant-servant | src/Servant/Servant/Db.hs | Haskell | bsd-3-clause | 1,081 |
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE QuasiQuotes #-}
-- | Github API: http://developer.github.com/v3/oauth/
module Main where
import Data.Aeson.TH (defaultOptions, deriveJSON)
import qualified Data.ByteString.Cha... | reactormonk/hoauth2 | example/StackExchange/test.hs | Haskell | bsd-3-clause | 2,512 |
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TupleSections #-}
-- | SendGrid Client
module Email.SendGrid.Client where
import Data.Bifunctor (bimap)
import Data.ByteString.Lazy.Builder
import qualified Data.ByteString as B
-- import qualified Data.ByteString.Lazy as BL
import qualified Data.By... | bitemyapp/sendgrid-haskell | src/Email/SendGrid/Client.hs | Haskell | bsd-3-clause | 4,729 |
{-# language CPP #-}
-- | = Name
--
-- VK_EXT_shader_atomic_float - device extension
--
-- == VK_EXT_shader_atomic_float
--
-- [__Name String__]
-- @VK_EXT_shader_atomic_float@
--
-- [__Extension Type__]
-- Device extension
--
-- [__Registered Extension Number__]
-- 261
--
-- [__Revision__]
-- 1
--
-- [... | expipiplus1/vulkan | src/Vulkan/Extensions/VK_EXT_shader_atomic_float.hs | Haskell | bsd-3-clause | 14,106 |
module Main ( main ) where
import Debug.Trace
import Control.Exception ( evaluate )
main :: IO ()
main = do
putStrLn "The test is successful if the word 'Evaluated' appears only once below:"
evaluate $ let x = trace "Evaluated" (1 + 1) in x + (trace "Evaluated" (1 + 1)) + x
return () | thoughtpolice/cse-ghc-plugin | tests/Traced.hs | Haskell | bsd-3-clause | 298 |
--------------------------------------------------------------------
-- !
-- Module : Text.TDoc.QQ
-- Copyright : (c) Nicolas Pouillard 2009-2011
-- License : BSD3
--
-- Maintainer : Nicolas Pouillard <nicolas.pouillard@gmail.com>
--
--------------------------------------------------------------------
{-# LANG... | np/tdoc | Text/TDoc/QQ.hs | Haskell | bsd-3-clause | 1,507 |
-- | Extra functions to help DFM deal with operators tree.
module Youtan.Regex.OperatorsExtra where
import Control.Monad.State
import Youtan.Regex.Operators ( Counter(..), Operator(..), OperatorID, initID, nextFreeID )
-- | Replaces counters in a tree with 'KleeneStar' keeping the input language.
simplifyCounter :: ... | triplepointfive/Youtan | src/Youtan/Regex/OperatorsExtra.hs | Haskell | bsd-3-clause | 1,903 |
import qualified TUDMensa as T
main = T.tudMensa T.defaultOpts
| dschoepe/tud-mensa | Main.hs | Haskell | bsd-3-clause | 64 |
{- Data/Singletons/Util.hs
(c) Richard Eisenberg 2013
eir@cis.upenn.edu
This file contains helper functions internal to the singletons package.
Users of the package should not need to consult this file.
-}
{-# LANGUAGE TypeSynonymInstances, FlexibleInstances, RankNTypes,
TemplateHaskell, GeneralizedNewt... | int-index/singletons | src/Data/Singletons/Util.hs | Haskell | bsd-3-clause | 15,210 |
module Emit where
import Syntax
import Codegen
import LLVM.Module
import LLVM.AST as AST
import LLVM.Context
import Control.Monad.Except
runEmit :: ExceptT String IO String -> IO String
runEmit e = do
result <- runExceptT e
case result of
Right code -> return code
Left error -> putStrLn error >> return ... | poiuj/pfcc | src/Emit.hs | Haskell | bsd-3-clause | 846 |
module ParserUtil ( runGet
, runGetMaybe
, parseManyLazily
, parseManyLazyByteStringLazily
, parseKeepRaw
, match
, match_
, eof
) where
import qualified Control.Monad as M
im... | benma/blockchain-parser-hs | src/ParserUtil.hs | Haskell | bsd-3-clause | 1,869 |
{-|
This is a module of cross-platform file handling for Unix\/Mac\/Windows.
The standard module "System.Directory" and "System.FilePath" have
following shortcomings:
* getModificationTime exists in "System.Directory". But getAccessTime,
getChangeTime, getCreationTime do not exist.
* getModificationTime returns ob... | kazu-yamamoto/easy-file | System/EasyFile.hs | Haskell | bsd-3-clause | 2,530 |
module Jerimum.Storage.PostgreSQL.Setup
( Context(..)
, setup
, destroy
, findSegment
, openSegment
, closeSegment
, addSchemas
) where
import Control.Monad
import qualified Data.Map as M
import Data.Monoid
import qualified Data.Text ... | dgvncsz0f/nws | src/Jerimum/Storage/PostgreSQL/Setup.hs | Haskell | bsd-3-clause | 5,022 |
-- Can get Pythagorean triplets via 2ab, a^2-b^2,a^2+b^2 trick
-- Brute-force some values of a and b
main :: IO ()
main = print answer
where possibleTrips :: [(Int,Int)]
possibleTrips = [(a,b) | a <- [1..500], b <- [1..500]]
passedTrips = filter (\(a,b) -> a>b && (2*a*b)+(a*a-b*b)+(a*a+b*b) ==... | akerber47/haskalah | test/files/euler/9.hs | Haskell | bsd-3-clause | 462 |
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE BangPatterns #-}
module Language.Fixpoint.Solver.Eliminate
(eliminateAll) where
import Language.Fixpoint.Types
import Language.Fixpoint.Types.Names (existSymbol)
import Language.Fixpoint.Types.Visitor (kvars)
import ... | gridaphobe/liquid-fixpoint | src/Language/Fixpoint/Solver/Eliminate.hs | Haskell | bsd-3-clause | 2,798 |
-- | @TemplateHaskell@ utilities for generating lens fields.
module Extended.Lens.TH
( fieldsVerboseLensRules
) where
import Universum
import Data.Char (toUpper)
import Data.List (stripPrefix)
import Language.Haskell.TH.Syntax (N... | serokell/importify | src/Extended/Lens/TH.hs | Haskell | mit | 1,262 |
-- | Types describing runtime errors related to DB.
module Pos.DB.Error
( DBError (..)
) where
import Formatting (bprint, int, stext, (%))
import qualified Formatting.Buildable
import Universum
data DBError =
-- | Structure of DB is malformed (e. g. data is inconsistent,
... | input-output-hk/pos-haskell-prototype | db/src/Pos/DB/Error.hs | Haskell | mit | 899 |
{-# LANGUAGE TemplateHaskellQuotes #-}
-- Trac #2632
module MkData where
import Language.Haskell.TH
op :: Num v => v -> v -> v
op a b = a + b
decl1 = [d| func = 0 `op` 3 |]
decl2 = [d| op x y = x
func = 0 `op` 3 |]
| mpickering/ghc-exactprint | tests/examples/ghc8/T2632.hs | Haskell | bsd-3-clause | 233 |
-- | Operations on the 'Area' type that involve random numbers.
module Game.LambdaHack.Server.DungeonGen.AreaRnd
( -- * Picking points inside areas
xyInArea, mkRoom, mkVoidRoom
-- * Choosing connections
, connectGrid, randomConnection
-- * Plotting corridors
, Corridor, connectPlaces
) where
import... | Concomitant/LambdaHack | Game/LambdaHack/Server/DungeonGen/AreaRnd.hs | Haskell | bsd-3-clause | 7,635 |
module Negation where
print' :: Double -> Fay ()
print' = print
main :: Fay ()
main = do print' $ (-7/2)
print' $ (-7)/2
print' $ -f x/y
where f n = n * n
x = 5
y = 2
| fpco/fay | tests/negation.hs | Haskell | bsd-3-clause | 216 |
{-# LANGUAGE CPP #-}
module CmmInfo (
mkEmptyContInfoTable,
cmmToRawCmm,
mkInfoTable,
srtEscape,
-- info table accessors
closureInfoPtr,
entryCode,
getConstrTag,
cmmGetClosureType,
infoTable,
infoTableConstrTag,
infoTableSrtBitmap,
infoTableClosureType,
infoTablePtrs,
infoTableNonPtrs,
... | lukexi/ghc | compiler/cmm/CmmInfo.hs | Haskell | bsd-3-clause | 20,843 |
<?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>Mga WebSocket | ZAP Extension</title>
<maps>
<homeID>top</homeID>
<mapr... | thc202/zap-extensions | addOns/websocket/src/main/javahelp/org/zaproxy/zap/extension/websocket/resources/help_fil_PH/helpset_fil_PH.hs | Haskell | apache-2.0 | 987 |
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-| Unittests for ganeti-htools.
-}
{-
Copyright (C) 2009, 2010, 2011, 2012 Google Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions a... | apyrgio/ganeti | test/hs/Test/Ganeti/Luxi.hs | Haskell | bsd-2-clause | 6,883 |
{-# LANGUAGE CPP, TypeFamilies #-}
-- -----------------------------------------------------------------------------
-- | This is the top-level module in the LLVM code generator.
--
module LlvmCodeGen ( llvmCodeGen, llvmFixupAsm ) where
#include "HsVersions.h"
import Llvm
import LlvmCodeGen.Base
import LlvmCodeGen.Co... | green-haskell/ghc | compiler/llvmGen/LlvmCodeGen.hs | Haskell | bsd-3-clause | 6,448 |
--------------------------------------------------------------------
-- |
-- Module : XMonad.Util.EZConfig
-- Copyright : Devin Mullins <me@twifkak.com>
-- Brent Yorgey <byorgey@gmail.com> (key parsing)
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : Devin Mullins <me@twifkak.com... | markus1189/xmonad-contrib-710 | XMonad/Util/EZConfig.hs | Haskell | bsd-3-clause | 26,039 |
module Test13 where
f (x:xs) = x : xs
g = 1 : [1,2]
| kmate/HaRe | old/testing/refacFunDef/Test13.hs | Haskell | bsd-3-clause | 55 |
{-# LANGUAGE TypeFamilyDependencies #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE TypeOperators #-}
module T14164 where
data G (x :: a) = GNil | GCons (G x)
type family F (xs :: [a]) (g :: G (z :: a)) = (res :: [a]) | res -> a where
F (x:xs) GNil = x:xs
F (x:xs) (GCons rest) = x:F xs rest
| sdiehl/ghc | testsuite/tests/indexed-types/should_compile/T14164.hs | Haskell | bsd-3-clause | 313 |
-- Original test case for #11627 (space_leak_001.hs)
import Data.List
main :: IO ()
main = print $ length $ show (foldl' (*) 1 [1..100000] :: Integer)
| ezyang/ghc | testsuite/tests/profiling/should_run/T11627a.hs | Haskell | bsd-3-clause | 153 |
{-# LANGUAGE TypeFamilies, RankNTypes #-}
module T10899 where
class C a where
type F a
type F a = forall m. m a
| ezyang/ghc | testsuite/tests/indexed-types/should_fail/T10899.hs | Haskell | bsd-3-clause | 118 |
{-# LANGUAGE TemplateHaskell, EmptyCase #-}
-- Trac #2431: empty case expression
-- now accepted
module Main where
import Language.Haskell.TH
f :: Int
f = $(caseE (litE $ CharL 'a') [])
main = print f
| urbanslug/ghc | testsuite/tests/th/TH_emptycase.hs | Haskell | bsd-3-clause | 217 |
-- Logic module
-- Functions for updating game state and responding to user input
module Logic(updateGameState, handleEvent) where
import State
import Piece
import Playfield
import Graphics.Gloss
import Graphics.Gloss.Interface.Pure.Game -- for Event
import System.Random
-- Piece falling velocity, in cel... | mgeorgoulopoulos/TetrisHaskellWeekend | Logic.hs | Haskell | mit | 4,308 |
-- Tenn1518's XMonad configuration
import XMonad
import XMonad.Actions.Warp
import XMonad.Actions.Commands
import XMonad.Actions.RotSlaves
import XMonad.Util.EZConfig
import XMonad.Util.Ungrab
import XMonad.Util.Loggers
import qualified XMonad.StackSet as W
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.Ewmh... | Tenn1518/dotfiles | config/xmonad/xmonad.hs | Haskell | mit | 3,744 |
-----------------------------------------------------------------------------
-- |
-- Module : GitBak
-- Copyright : (c) Agorgianitis Loukas, 2015
-- License : MIT
--
-- Maintainer : Agorgianitis Loukas <agorglouk@gmail.com>
-- Stability : experimental
-- Portability : portable
--
-- Main of gitbak execut... | ElArtista/GitBak | src/Main.hs | Haskell | mit | 5,319 |
-- Section 6
import Data.List
import qualified Data.Map as Map
import Data.Char
numUniques :: (Eq a) => [a] -> Int
numUniques = length . nub
wordNums :: String -> [(String, Int)]
wordNums = map (\ws -> (head ws, length ws)) . group . sort . words
digitSum :: Int -> Int
digitSum = sum .map digitToInt . show
firstTo... | ymkjp/Algorithms-and-Data-Structures | 6.hs | Haskell | mit | 1,230 |
{-# LANGUAGE GADTs #-}
module Main where
import Test.Framework.Runners.Console
import Test.Framework.Providers.API
import Test.Framework.Providers.HUnit
import Test.HUnit
import Data.List
import Data.Traversable
--import LProperties
import LUnitTests
main = do
unitTests <- LUnitTests.tests
defaultMain [unitTes... | joshcough/L5-Haskell | test/main.hs | Haskell | mit | 348 |
module MessageProperties where
import Data.Binary
import qualified Data.ByteString.Lazy as LBS
import Network.Linx.Gateway.Message
import Network.Linx.Gateway.Types
import Generators ()
prop_message :: Message -> Bool
prop_message message@(Message _ msgPayload) =
let encodedMessage = encode message
... | kosmoskatten/linx-gateway | test/MessageProperties.hs | Haskell | mit | 598 |
-- Copyright (c) 2014 Zachary King
import System.Environment
import Data.Time
data Entry = Entry { line :: String
, time :: UTCTime
} deriving (Show)
type Index = [Entry]
emptyIndex :: Index
emptyIndex = []
main :: IO ()
main = loop emptyIndex
loop :: Index -> IO ... | zakandrewking/eightball | eightball.hs | Haskell | mit | 557 |
module Grammar
( Grammar (..)
, ProductionElement (..)
, Production (..)
, isDiscardable
, isSymbol
, fromSymbol
) where
import qualified Data.Map as Map
data Grammar terminals productionNames symbols = Grammar
{ startSymbol :: symbols
, productions :: Map.Map productionNames (Prod... | mrwonko/wonkococo | wcc/Grammar.hs | Haskell | mit | 2,590 |
import Test.HUnit (Assertion, (@=?), runTestTT, Test(..))
import Control.Monad (void)
import Gigasecond (fromDay)
import Data.Time.Calendar (fromGregorian)
testCase :: String -> Assertion -> Test
testCase label assertion = TestLabel label (TestCase assertion)
main :: IO ()
main = void $ runTestTT $ TestList
[ ... | tfausak/exercism-solutions | haskell/gigasecond/gigasecond_test.hs | Haskell | mit | 771 |
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Application
( makeApplication
, getApplicationDev
, makeFoundation
) where
import Import
import Settings
import Yesod.Auth
import Yesod.Default.Config
import Yesod.Default.Main
import Yesod.Default.Handlers
import Network.Wai.Middleware.RequestLogger
import ... | lulf/wishsys | Application.hs | Haskell | mit | 2,809 |
--------------------------------------------------------------------------------
{-# LANGUAGE OverloadedStrings #-}
import Control.Applicative ((<$>))
import Data.Monoid (mconcat,(<>))
import Data.Function (on)
import Data.List (sortBy,intersperse,intercalate,isInfixOf)
import ... | benkolera/blog | hs/Site.hs | Haskell | mit | 3,428 |
-- |This module, and the corresponding 'Zeno.Isabellable' modules,
-- deal with the conversion a 'ProofSet' into Isabelle/HOL code, outputting this
-- code into a file and then checking this file with Isabelle.
module Zeno.Isabelle (
toIsabelle
) where
import Prelude ()
import Zeno.Prelude
import Zeno.Core
import Ze... | Gurmeet-Singh/Zeno | src/Zeno/Isabelle.hs | Haskell | mit | 1,484 |
-- Simple Haskell program that generates KB clauses for the position functions.
n (x,y) = (x,y-1)
e (x,y) = (x+1,y)
s (x,y) = (x,y+1)
w (x,y) = (x-1,y)
ne (x,y) = (x+1,y-1)
se (x,y) = (x+1,y+1)
nw (x,y) = (x-1,y-1)
sw (x,y) = (x-1,y+1)
xrange = [1..4]
yrange = [1..4]
valid (x,y) = x `elem` xrange && y `elem` yrange
... | schwering/limbo | examples/tui/battleship-pos.hs | Haskell | mit | 700 |
module Main where
import Day7.Main
main = run
| brsunter/AdventOfCodeHaskell | src/Main.hs | Haskell | mit | 46 |
main :: IO ()
main = do
p1 <- getLine
p2 <- getLine
let [x1, y1] = map (\x -> read x :: Int) (words p1)
[x2, y2] = map (\x -> read x :: Int) (words p2)
print $ abs (x1 - x2) + abs (y1 - y2) + 1
| knuu/competitive-programming | atcoder/other/idn_qb_1.hs | Haskell | mit | 208 |
{-# LANGUAGE LambdaCase #-}
module Main where
import Control.Concurrent hiding (Chan)
import Control.Concurrent.GoChan
import Control.Monad
import Data.IORef
import Test.Hspec
main :: IO ()
main =
hspec $
do describe "with buffer size 0" $
... | cstrahan/gochan | fuzz/Main.hs | Haskell | mit | 5,923 |
module Problem16 where
import Data.Char (digitToInt)
main = print . sum . map digitToInt . show $ 2^1000
| DevJac/haskell-project-euler | src/Problem16.hs | Haskell | mit | 107 |
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE StandaloneDeriving #-}
-- | /Warning/: This is an internal module and subject
-- to change without notice.
module System.ZMQ4.Internal
( Context (..)
, Socket (..)
, SocketRepr (..)
, Socket... | twittner/zeromq-haskell | src/System/ZMQ4/Internal.hs | Haskell | mit | 12,198 |
module Data.Hadoop.SequenceFile.Types
( Header(..)
, MD5(..)
, RecordBlock(..)
) where
import Data.ByteString (ByteString)
import qualified Data.ByteString as B
import Data.Text (Text)
import Text.Printf (printf)
import Data.Hadoop.Writable
--------------------... | jystic/hadoop-formats | src/Data/Hadoop/SequenceFile/Types.hs | Haskell | apache-2.0 | 1,943 |
{-# LANGUAGE OverloadedStrings #-}
module Web.Actions.User where
import Web.Utils
import Model.ResponseTypes
import Model.CoreTypes
import System.Random
import Database.Persist
import Database.Persist.Sql
import Data.Word8
import Control.Monad
import Data.Time
import Control.Monad.Trans
import qualified Data.ByteStri... | agrafix/funblog | src/Web/Actions/User.hs | Haskell | apache-2.0 | 2,807 |
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE PackageImports #-}
{-
Copyright 2019 The CodeWorld Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http:... | alphalambda/codeworld | codeworld-base/src/Prelude.hs | Haskell | apache-2.0 | 1,393 |
-- 1533776805
import Data.List.Ordered(isect, member)
import Euler(triangular, pentagonal, hexagonal)
nn = 143
-- walk the pentagonal and triangular lists
-- check whether the hexagonal value is in them
-- also provide the remainder of each list for the next check
walkSet n ps ts = (member n $ isect ps2 ts2, ps3, ts3... | higgsd/euler | hs/45.hs | Haskell | bsd-2-clause | 676 |
module Chart.Distribution (renderContinuousDistribution,
renderDiscreteDistribution,
continuousDistributionPlot,
discreteDistributionPlot) where
import Graphics.Rendering.Chart
import Graphics.Rendering.Chart.Backend.Cairo
import Data.Colo... | richardfergie/chart-distribution | Chart/Distribution.hs | Haskell | bsd-3-clause | 2,929 |
module Unregister where
import InstalledPackages
import Distribution.Text
import Distribution.Package (PackageId)
import Distribution.Simple.PackageIndex
import Distribution.InstalledPackageInfo
import Distribution.Simple.GHC
import Distribution.Simple.Program.HcPkg
import Distribution.Simple.Compiler (PackageDB(..))
... | glguy/GhcPkgUtils | Unregister.hs | Haskell | bsd-3-clause | 1,525 |
{-|
Module : Idris.Elab.Term
Description : Code to elaborate terms.
Copyright :
License : BSD3
Maintainer : The Idris Community.
-}
{-# LANGUAGE LambdaCase, PatternGuards, ViewPatterns #-}
{-# OPTIONS_GHC -fwarn-incomplete-patterns #-}
module Idris.Elab.Term where
import Idris.AbsSyntax
import Idris.AbsSyn... | KaneTW/Idris-dev | src/Idris/Elab/Term.hs | Haskell | bsd-3-clause | 132,339 |
{-# language CPP #-}
-- No documentation found for Chapter "ExternalMemoryFeatureFlagBits"
module Vulkan.Core11.Enums.ExternalMemoryFeatureFlagBits ( ExternalMemoryFeatureFlags
, ExternalMemoryFeatureFlagBits( EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT
... | expipiplus1/vulkan | src/Vulkan/Core11/Enums/ExternalMemoryFeatureFlagBits.hs | Haskell | bsd-3-clause | 4,826 |
{-|
Module : ChainFlyer
Copyright : (c) Tatsuya Hirose, 2015
License : BSD3
Maintainer : tatsuya.hirose.0804@gmail.com
-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DeriveGeneric #-}
module Servant.ChainFlyer.Types.Transaction
( TransactionInput(..)
, TransactionOutput(..)
, Transaction(..)
) where
... | lotz84/chainFlyer | src/Servant/ChainFlyer/Types/Transaction.hs | Haskell | bsd-3-clause | 3,091 |
module JIT where
import Foreign.Ptr (FunPtr, castFunPtr)
import Control.Monad.Except
import qualified LLVM.General.AST as AST
import LLVM.General.Context
import qualified LLVM.General.ExecutionEngine as EE
import LLVM.General.Module as Mod
import LLVM.General.PassManager
foreign import ccall "dynamic" haskFun :: Fu... | jjingram/satori | src/JIT.hs | Haskell | bsd-3-clause | 1,379 |
-- parser produced by Happy Version 1.13
{-
%
% (c) The GRASP/AQUA Project, Glasgow University, 1998
%
% @(#) $Docid: Jul. 12th 2001 10:08 Sigbjorn Finne $
% @(#) $Contactid: sof@galconn.com $
%
A grammar for OMG CORBA IDL
-}
module OmgParser ( parseIDL ) where
import LexM
import Lex
import IDLTo... | dchagniot/hdirect | src/OmgParser.hs | Haskell | bsd-3-clause | 98,554 |
module Cz.MartinDobias.ChristmasKoma.PadCracker (
Message,
PossibleKeystrokes,
Passphrase(..),
crack,
decode,
zipAll
) where
import Data.Char(ord, chr)
import Data.Bits(xor)
type Message = String
type PossibleKeystrokes = [Char]
type AvailableChars = [Char]
type Passphrase = [PossibleKeystroke... | martindobias/christmass-koma | src/Cz/MartinDobias/ChristmasKoma/PadCracker.hs | Haskell | bsd-3-clause | 1,989 |
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE ScopedTypeVariables #-}
module FPNLA.Operations.BLAS.Strategies.SYRK.MonadPar.DefPar () where
import Control.DeepSeq (NFData)
import Contr... | mauroblanco/fpnla-examples | src/FPNLA/Operations/BLAS/Strategies/SYRK/MonadPar/DefPar.hs | Haskell | bsd-3-clause | 2,251 |
{-# LANGUAGE GeneralizedNewtypeDeriving, ScopedTypeVariables, KindSignatures, GADTs, InstanceSigs, TypeOperators, MultiParamTypeClasses, FlexibleInstances, OverloadedStrings #-}
module Text.AFrame where
import Control.Applicative
import Data.Char (isSpace)
import Data.Generic.Diff
import Data.Map(Map)
import Data.Str... | ku-fpg/aframe | src/Text/AFrame.hs | Haskell | bsd-3-clause | 13,322 |
-- | This module provides the /TcT/ monad.
module Tct.Core.Data.TctM
(
-- * Tct Monad
TctM (..)
, TctROState (..)
, TctStatus (..)
, askState
, setState
, setKvPair
, getKvPair
, askStatus
-- * Lifted IO functions
, async
, wait
, timed
, paused
, raceWith
, concurrently
) where
im... | ComputationWithBoundedResources/tct-core | src/Tct/Core/Data/TctM.hs | Haskell | bsd-3-clause | 4,268 |
module Dir.CoerceType(CoerceType(..)) where
newtype CoerceType = CoerceType Int
| ndmitchell/weeder | test/foo/src/Dir/CoerceType.hs | Haskell | bsd-3-clause | 81 |
{-# LANGUAGE OverloadedStrings #-}
module Rede.Workers.VeryBasic(
veryBasic
,bad404ResponseData
,bad404ResponseHeaders
) where
import qualified Data.ByteString as B
import Data.Conduit
import Data.ByteString.Char8 (pack)
import Rede.MainLoop.CoherentWorker
trivialHeaders :: ... | loadimpact/http2-test | hs-src/Rede/Workers/VeryBasic.hs | Haskell | bsd-3-clause | 1,060 |
import Data.Aeson
import qualified Data.ByteString.Lazy as B
import qualified Data.Map as Map
jsonFile :: FilePath
jsonFile = "kataids.json"
hsFile :: FilePath
hsFile = "Kataids.hs"
getJSON :: IO B.ByteString
getJSON = B.readFile jsonFile
kidspref = "module Kataids where\n\
\import qualified Data.Map as ... | klpn/lablinkfix | kataidsgen.hs | Haskell | bsd-3-clause | 558 |
{-
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998
\section[SimplCore]{Driver for simplifying @Core@ programs}
-}
{-# LANGUAGE CPP #-}
module SimplCore ( core2core, simplifyExpr ) where
#include "HsVersions.h"
import GhcPrelude
import DynFlags
import CoreSyn
import HscTypes
import CSE ( cse... | shlevy/ghc | compiler/simplCore/SimplCore.hs | Haskell | bsd-3-clause | 45,493 |
module System.Build.Access.Top where
class Top r where
top ::
Maybe String
-> r
-> r
getTop ::
r
-> Maybe String
| tonymorris/lastik | System/Build/Access/Top.hs | Haskell | bsd-3-clause | 144 |
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE UndecidableInstances #-}
module Data.Typewriter.Data.List where
import Data.Typewriter.Core
type family Head xs :: *
type instance Head (h :*:... | isomorphism/typewriter | Data/Typewriter/Data/List.hs | Haskell | bsd-3-clause | 2,383 |
module Events.LeaveChannelConfirm where
import Prelude ()
import Prelude.MH
import qualified Graphics.Vty as Vty
import State.Channels
import Types
onEventLeaveChannelConfirm :: Vty.Event -> MH ()
onEventLeaveChannelConfirm (Vty.EvKey k []) = do
case k of
Vty.KCh... | aisamanra/matterhorn | src/Events/LeaveChannelConfirm.hs | Haskell | bsd-3-clause | 467 |
{-# LANGUAGE OverloadedStrings #-}
module Data.GraphQL.AST.Transform where
import Control.Applicative (empty)
import Control.Monad ((<=<))
import Data.Bifunctor (first)
import Data.Either (partitionEithers)
import Data.Foldable (fold, foldMap)
import qualified Data.List.NonEmpty as NonEmpty
import Data.Monoid (Alt(Alt... | jdnavarro/graphql-haskell | Data/GraphQL/AST/Transform.hs | Haskell | bsd-3-clause | 4,328 |
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE Tem... | mikeplus64/trifecta | src/Text/Trifecta/Result.hs | Haskell | bsd-3-clause | 5,198 |
--------------------------------------------------------------------------------
-- |
-- Module : Graphics.Rendering.OpenGL.Raw.EXT.FourTwoTwoPixels
-- Copyright : (c) Sven Panne 2015
-- License : BSD3
--
-- Maintainer : Sven Panne <svenpanne@gmail.com>
-- Stability : stable
-- Portability : portabl... | phaazon/OpenGLRaw | src/Graphics/Rendering/OpenGL/Raw/EXT/FourTwoTwoPixels.hs | Haskell | bsd-3-clause | 707 |
{-# LANGUAGE DeriveDataTypeable, RecordWildCards #-}
module Main where
import Control.Monad (liftM, when)
import Data.Bits
import Data.Char
import Data.List (foldl', nub)
import Numeric
import System.Console.CmdArgs.Implicit
import System.IO
import System.Directory
import System.Exit
data Opts = Opts
{ hex :: [Strin... | listx/syscfg | script/panxor.hs | Haskell | bsd-3-clause | 6,620 |
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE FlexibleContexts #-}
module EFA.Application.Simulation where
import EFA.Application.Utility (quantityTopology)
import qualified EFA.Application.Optimisation.Sweep as Sweep
import EFA.Application.Optimisation.Params ... | energyflowanalysis/efa-2.1 | src/EFA/Application/Simulation.hs | Haskell | bsd-3-clause | 5,080 |
{-# LANGUAGE ViewPatterns, TupleSections #-}
-- | Easy logging of images and matrices(palnned) for CV research.
-- messages are send via TCP connection as MessagePack objects.
--
-- * ["str", utf8 string]: string
--
-- * ["uni", "u8", shape, raw]: uniform array
--
module Main where
import Control.Concurrent
import Cont... | xanxys/mmterm | Main.hs | Haskell | bsd-3-clause | 7,101 |
module DTW
(
dtw, cdtw, gdtw
) where
import Data.Array
import Data.List (foldl1')
add :: (Double, Int) -> (Double, Int) -> (Double, Int)
add (a, b) (c, d) = (a+c, b+d)
quo :: (Double, Int) -> Double
quo (a, b) = a/(fromIntegral b)
-- Unconstrained DTW
dtw :: Eq a => ( a -> a -> Double ) -> [a] -> [a] -> Double... | kirel/detexify-hs-backend | src/DTW.hs | Haskell | mit | 2,359 |
{-# LANGUAGE ScopedTypeVariables
, GADTs
#-}
{-# OPTIONS_GHC
-F
-pgmF hspec-discover
-optF --module-name=Spec
-fno-warn-implicit-prelude
#-}
| hanepjiv/make10_hs | test/spec/Spec.hs | Haskell | mit | 183 |
{-# LANGUAGE PatternGuards #-}
module Lambda.Text.Reduction
( rNF
, rHNF
, reduce1
, isNF
, isHNF
) where
import Lambda.Text.Term
import Lambda.Text.InputSet
import qualified Lambda.Text.Substitution as S
reduce2NF :: NormalForm -> InputSet -> Term -> Term
reduce2NF nf ips t = undefined
seq... | jaiyalas/haha | src/Lambda/Text/Reduction.hs | Haskell | mit | 2,478 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.