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 : GenerateForm -- Copyright : -- License : BSD3 -- -- Maintainer : agocorona@gmail.com -- Stability : experimental -- Portability : -- -- | -- --------------------------------------------------------------------...
agocorona/MFlow
Demos/GenerateForm.hs
Haskell
bsd-3-clause
5,448
{-# LANGUAGE ViewPatterns, PatternGuards, FlexibleContexts #-} {- Find and match: <TEST> yes = 1:2:[] -- [1,2] yes = ['h','e','l','l','o'] -- "hello" yes (1:2:[]) = 1 -- [1,2] yes ['h','e'] = 1 -- "he" -- [a]++b -> a : b, but only if not in a chain of ++'s yes = [x] ++ xs -- x : xs no = "x" ++ xs no = [x] ++ xs ...
fpco/hlint
src/Hint/List.hs
Haskell
bsd-3-clause
3,163
{-# LANGUAGE FlexibleContexts #-} module Jade.Part ( isTerm , isSubModule , removeTerms , bundle , getValsWithIdent , getBundleWithIdent , getBundleWithLit , width , hasVal ...
drhodes/jade2hdl
src/Jade/Part.hs
Haskell
bsd-3-clause
3,462
{-# LANGUAGE GADTs, PolyKinds, TypeOperators, CPP #-} {-# OPTIONS_GHC -fno-warn-orphans -fno-warn-warnings-deprecations #-} ----------------------------------------------------------------------------- -- | -- Module : Language.Glambda.Util -- Copyright : (C) 2015 Richard Eisenberg -- License : BSD-style...
goldfirere/glambda
src/Language/Glambda/Util.hs
Haskell
bsd-3-clause
2,186
{-# language CPP #-} -- | = Name -- -- VK_KHR_push_descriptor - device extension -- -- == VK_KHR_push_descriptor -- -- [__Name String__] -- @VK_KHR_push_descriptor@ -- -- [__Extension Type__] -- Device extension -- -- [__Registered Extension Number__] -- 81 -- -- [__Revision__] -- 2 -- -- [__Extension a...
expipiplus1/vulkan
src/Vulkan/Extensions/VK_KHR_push_descriptor.hs
Haskell
bsd-3-clause
31,852
{-# LANGUAGE ForeignFunctionInterface #-} module OIS.OISObject( object_delete, object_type, object_buffered, object_getCreator, object_setBuffered, object_capture, object_getID, object_queryInterface, object__initialize ) where import OIS.Types import Control.Monad import Foreign import Foreign.C.String impo...
ghorn/hois
OIS/OISObject.hs
Haskell
bsd-3-clause
2,080
{-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE ExistentialQuantification #-} {-# L...
martyall/kafaka-test
src/Types.hs
Haskell
bsd-3-clause
9,181
{-# LANGUAGE FlexibleInstances , NoMonomorphismRestriction , TypeFamilies , UndecidableInstances #-} module Data.CRDT.Classes where import Prelude hiding (null) import Algebra.Enumerable (Enumerable(..)) import Control.Arrow ((***)) import qualified Data.Set as S import qualified Data.IntSet as IS impo...
mgsloan/crdt
src/Data/CRDT/Classes.hs
Haskell
bsd-3-clause
4,287
------------------------------------------------------------------------------- -- | -- Module : XMonad.Util.ClickableWorkspaces -- Description : Make workspace tags clickable in XMobar (for switching focus). -- Copyright : (c) Geoff deRosenroll <geoffderosenroll@gmail.com> -- License : BSD3-style (see L...
xmonad/xmonad-contrib
XMonad/Util/ClickableWorkspaces.hs
Haskell
bsd-3-clause
3,314
module BaristaSpec where import Data.Aeson (Value(..), object, (.=)) import Test.Hspec import Test.Hspec.Wai import Test.Hspec.Wai.JSON import Barista (app) spec :: Spec spec = with app $ do describe "GET /test" $ do it "responds with 200" $ do get "/test" `shouldRespondWith` 200 it "responds with '...
semaj/espresso
test/BaristaSpec.hs
Haskell
bsd-3-clause
878
{- | Module : Graphics.XDot.Viewer Copyright : (c) Dennis Felsing License : 3-Clause BSD-style Maintainer : dennis@felsin9.de This module draws the operations of an xdot graph using Cairo and Pango on a Gtk canvas. -} module Graphics.XDot.Viewer ( drawAll ) where import Graphics.XDot....
FranklinChen/xdot
src/Graphics/XDot/Viewer.hs
Haskell
bsd-3-clause
6,518
{-| Contains miscellaneous utility functions such as functions for working with signals and signal generators. -} module FRP.Helm.Utilities ( -- * Angles radians, degrees, turns, -- * Applying (<|), (|>), ) where {-| Converts radians into the standard angle measurement (radians). -} radians :: Double -> ...
didmar/helm
src/FRP/Helm/Utilities.hs
Haskell
mit
927
{-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE Arrows #-} module Main where import Opaleye import Data.Profunctor.Product import Data.Profunctor.Product.Default import Data.Profunctor...
vacationlabs/haskell-webapps
doc/docs/opaleye/code/opaleye-enums-handling.hs
Haskell
mit
2,428
{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE OverloadedStrings #-} {-# OPTIONS_GHC -fno-warn-missing-fields #-} {-# OPTIONS_GHC -fno-warn-missing-signatures #-} {-# OPTIONS_GHC -fno-warn-name-shadowing #-} {-# OPTIONS_GHC -fno-warn-unused-imports #-} {-# OPTIONS_GHC -fno-warn-unused-matches #-} -------------------...
sinjar666/fbthrift
thrift/compiler/test/fixtures/includes/gen-hs/Includes_Types.hs
Haskell
apache-2.0
4,291
module GHC.Coercion where import GHC.Kind import GHC.Var import GHC.Type import Utilities data Coercion = CoVarCo CoVarId | ReflCo Type | AppCo Coercion Coercion | SymCo Coercion | TransCo Coercion Coercion | NthCo Int Coercion | Fo...
beni55/cps-core
GHC/Coercion.hs
Haskell
bsd-3-clause
2,022
{-# LANGUAGE BangPatterns #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TupleSections #-} {-# LANGUAGE ScopedTypeVariables #-} -- Load information on package sources module S...
ant1441/stack
src/Stack/Build/Source.hs
Haskell
bsd-3-clause
20,978
{-# LANGUAGE DataKinds #-} {-# LANGUAGE DerivingStrategies #-} {-# LANGUAGE ExistentialQuantification #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE KindSignatures #-} {-# LANGUAGE RankNT...
advancedtelematic/quickcheck-state-machine-model
src/Test/StateMachine/Lockstep/Simple.hs
Haskell
bsd-3-clause
8,987
{-| Utility functions for MonadPlus operations -} {- 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 copyright n...
leshchevds/ganeti
src/Ganeti/Utils/Monad.hs
Haskell
bsd-2-clause
3,508
-- | -- Module : Crypto.PubKey.RSA.Prim -- License : BSD-style -- Maintainer : Vincent Hanquez <vincent@snarc.org> -- Stability : experimental -- Portability : Good -- module Crypto.PubKey.RSA.Prim ( -- * Decrypt primitive dp -- * Encrypt primitive , ep ) where import Cr...
tekul/cryptonite
Crypto/PubKey/RSA/Prim.hs
Haskell
bsd-3-clause
2,507
{-# OPTIONS_GHC -Wall #-} module Reporting.Error.Docs where import qualified Reporting.Report as Report data Error = NoDocs | OnlyInDocs String | OnlyInExports String | NoComment String | NoType String -- TO REPORT toReport :: Error -> Report.Report toReport err = case err of NoDocs -> ...
JoeyEremondi/elm-summer-opt
src/Reporting/Error/Docs.hs
Haskell
bsd-3-clause
2,294
yes = reverse xs `isPrefixOf` reverse ys
bitemyapp/apply-refact
tests/examples/Default18.hs
Haskell
bsd-3-clause
40
{-# OPTIONS -fglasgow-exts #-} -- Don't do the cunning new newtype-deriving thing -- when the type constructor is recursive module ShouldCompile where newtype A = A [A] deriving (Eq) test :: A -> A -> Bool test x y = x == y
hvr/jhc
regress/tests/1_typecheck/2_pass/ghc/tc159.hs
Haskell
mit
228
import System.IO file = "readwrite003.txt" main = do writeFile file "ab\ncd\nef\ngh" h <- openFile file ReadWriteMode hGetLine h hPutStrLn h "yz" hClose h h <- openBinaryFile file ReadMode hSetNewlineMode stdout noNewlineTranslation hGetContents h >>= putStr
olsner/ghc
libraries/base/tests/IO/readwrite003.hs
Haskell
bsd-3-clause
277
{-# OPTIONS -XRecursiveDo #-} -- test of user defined instance of MonadFix module Main (main) where import Control.Monad import Control.Monad.Fix data X a = X a deriving Show instance Functor X where fmap f (X a) = X (f a) instance Applicative X where pure = return (<*>) = ap instance Monad X where retu...
olsner/ghc
testsuite/tests/mdo/should_compile/mdo002.hs
Haskell
bsd-3-clause
516
import Control.Concurrent import Control.Exception -- test blocking & unblocking of async exceptions. -- the first exception "foo" should be caught by the "caught1" handler, -- since async exceptions are blocked outside this handler. -- the second exception "bar" should be caught by the outer "caught2" handler, -- (...
ezyang/ghc
testsuite/tests/concurrent/should_run/conc015.hs
Haskell
bsd-3-clause
1,386
{-# LANGUAGE DeriveDataTypeable #-} module A where import Data.Data import Data.Typeable data Foo = Foo Int deriving (Show, Data, Typeable)
olsner/ghc
testsuite/tests/quasiquotation/T4491/A.hs
Haskell
bsd-3-clause
145
{-# LANGUAGE Trustworthy #-} {-# LANGUAGE BangPatterns, GeneralizedNewtypeDeriving, NoImplicitPrelude #-} module GHC.Event.Unique ( UniqueSource , Unique(..) , newSource , newUnique ) where import Data.Int (Int64) import GHC.Base import GHC.Conc.Sync (TVar, atomically, newTVarIO, readTVar, w...
tolysz/prepare-ghcjs
spec-lts8/base/GHC/Event/Unique.hs
Haskell
bsd-3-clause
1,121
笑 :: Int 笑 = 3 main = print 笑
urbanslug/ghc
testsuite/tests/parser/should_compile/T3741.hs
Haskell
bsd-3-clause
37
{-# LANGUAGE OverloadedStrings, RecordWildCards #-} module NLP.Stemmer.Cistem (stem,stemCaseInsensitive,Segmentation(..),segment',segment,segment'CaseInsensitive,segmentCaseInsensitive) where import Data.Char import Data.Monoid import Data.Text as T -- | Guess the word stem. This module uses the CISTEM algorithm, pu...
LeonieWeissweiler/CISTEM
Cistem.hs
Haskell
mit
3,759
module Test.Expr.GroupBy ( groupByTests, ) where import qualified Control.Monad.IO.Class as MIO import qualified Data.ByteString.Char8 as B8 import qualified Data.Int as Int import qualified Data.List.NonEmpty as NE import qualified Data.Pool as Pool import qualified Data.Text as T import qualified Orville.Postgr...
flipstone/orville
orville-postgresql-libpq/test/Test/Expr/GroupBy.hs
Haskell
mit
4,256
{-# LANGUAGE DataKinds #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TypeOperators #-} module Mattermost.Api ( Api , MessagePayload(..) , Attachment(..) , Field(..) , hook , api ) where import Data.Text (Text) import Servant import ...
UlfS/ghmm
src/Mattermost/Api.hs
Haskell
mit
765
module Prepare.Source.Output where import Prelude hiding (Word, last) import qualified Data.Char as Char import qualified Data.List as List import qualified Data.List.Split as Split import Data.Text (Text) import qualified Data.Text as Text import qualified Data.Text.IO as Text import qualified System.Directory as Fil...
ancientlanguage/haskell-analysis
prepare/src/Prepare/Source/Output.hs
Haskell
mit
6,385
{-# LANGUAGE FlexibleInstances, TypeSynonymInstances, CPP, DeriveDataTypeable, DeriveFunctor #-} ----------------------------------------------------------------------------- -- | -- Module : Language.Python.Common.AST -- Copyright : (c) 2009 Bernie Pope -- License : BSD-style -- Maintainer : bjpop@csse.uni...
TOSPIO/pyn
lib/Language/Python/Common/AST.hs
Haskell
mit
27,628
module ProjectEuler.Problem104 ( problem ) where import qualified Data.Set as S import ProjectEuler.Types problem :: Problem problem = pureProblem 104 Solved result fibs :: [Integer] fibs = 0:1:zipWith (+) (tail fibs) fibs -- internal only. as we are only interest in some particular parts -- of the "show" resu...
Javran/Project-Euler
src/ProjectEuler/Problem104.hs
Haskell
mit
763
module RecursiveContents (getRecursiveContents) where import Control.Monad (forM) import System.Directory (doesDirectoryExist, getDirectoryContents) import System.FilePath ((</>)) getRecursiveContents :: FilePath -> IO [FilePath] getRecursiveContents topdir = do names <- getDirectoryContents topdir let proper...
mithril1992/HaskellPractice
RecursiveContents.hs
Haskell
mit
614
{-# LANGUAGE QuasiQuotes #-} module Y2018.M02.D06.Solution where {-- What were the articles uploaded or updated today? How do we find that out? We ... can determine this, given our current upload process: we look in the logs. This, however, is not desireable: we simply want to answer a question with no manual (parsi...
geophf/1HaskellADay
exercises/HAD/Y2018/M02/D06/Solution.hs
Haskell
mit
2,924
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE OverloadedStrings #-} module AtnBot.UserTracker ( TrackerHandle , newTrackerHandle , trackUser , getTrackedUsers , lookupIMChannel , channelIsIM ) where import Control.Lens import Con...
asayers/attendancebot
src/AtnBot/UserTracker.hs
Haskell
mit
1,544
module Runtime( typeCast, defaultVal, toBool, boolType, true, false, isTrue, isFalse, voidType, void, intType, makePtr )where import Grammar import Parse import Type import Value import Control.Applicative -- Input: Target type, a RIGHT value typeCast :: Type -> Value -> Value typeCast t1 v@(RVal t2 x) | t1 == t1...
sqd/haskell-C89-interpreter
Runtime.hs
Haskell
mit
1,027
{- HAAP: Haskell Automated Assessment Platform This module runs the @GHC@ plugin with the @-Wall@ flag to give all kinds of warnings on code quality. -} {-# LANGUAGE EmptyDataDecls, TypeFamilies, FlexibleInstances, FlexibleContexts, UndecidableInstances, MultiParamTypeClasses, OverloadedStrings #-} module HAAP.Code...
hpacheco/HAAP
src/HAAP/Code/GHC.hs
Haskell
mit
3,039
{-# LANGUAGE GADTs, KindSignatures #-} data List :: * -> * where Nil :: List a Cons :: a -> List a -> List a concat' = \as bs -> case as of [] -> bs (:) a as -> (:) a (concat' as bs) showPosInt = \n -> let showDigit = \d -> case d of 0 -> '0' 1 -> '1' 2 -> '2' 3 -> '3' 4 -...
CindyLinz/Haskell.js
trans/sample/fibs.hs
Haskell
mit
1,453
{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE TemplateHaskell #-} module SoOSiM.Components.Thread.Behaviour where import Control.Concurrent.STM import Control.Concurrent.STM.TQueue import Control.Lens import Control.Monad import Data.Maybe import SoOSiM import SoOSiM.Components.Common import SoOSiM.Components....
christiaanb/SoOSiM-components
src/SoOSiM/Components/Thread/Behaviour.hs
Haskell
mit
2,600
{-| Module : Control.Arrow.Needle Description : ASCII-fied arrow notation. Copyright : (c) 2014 Josh Kirklin License : MIT Maintainer : jjvk2@cam.ac.uk Needle is a domain specific language for ASCII-fied arrow notation. This module enables the use of needle within Haskell by making use of Template Haskell....
ScrambledEggsOnToast/needle
Control/Arrow/Needle.hs
Haskell
mit
1,796
-- generic functions can be defined :t fast :t head
luisgepeto/HaskellLearning
03 Types and Typeclasses/02_type_variables.hs
Haskell
mit
52
module Parser.Parser where import Control.Monad (liftM) import Numeric (readFloat) import Text.ParserCombinators.Parsec hiding (spaces) import Parser.Types.LispVal parseExpr :: Parser LispVal parseExpr = parseAtom <|> parseString <|> parseNumber <|> parseQuasiQuoted <|> parseQuoted <|> par...
slogsdon/haskell-exercises
write-a-scheme/parsing/src/Parser/Parser.hs
Haskell
mit
2,561
{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeApplications #-} {-# LANG...
zenhack/haskell-capnp
lib/Capnp/New/Accessors.hs
Haskell
mit
7,708
-- xmobar configuration file -- -- Mess with this file to change the appearance of the contents of the status -- bar which are not directly controlled by xmonad. You can see your changes -- immediately by recompiling xmonad using "super-q". -- -- There's a lot you can do here. Refer to "man xmobar". -- -- Author: David...
diminishedprime/dotfiles
.xmonad/xmobarrc.hs
Haskell
mit
3,657
{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} -- | -- Module : DNA.Logging -- Copyright : (C) 2014-2015 Braam Research, LLC. -- License : Apache-2.0 -- -- Logging and profiling facilities. Log messages are written to GHC's -- eventlog in the following f...
SKA-ScienceDataProcessor/RC
MS3/lib/DNA/Logging.hs
Haskell
apache-2.0
27,011
{-# LANGUAGE CPP #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} module CloudTests (cloudTests) where import Control.Monad import Control.Monad.IO.Class import Data.ByteArray as BA import System.Directory import System.Directory.Tree import System.FilePath import Sys...
rblaze/private-cloud
test/CloudTests.hs
Haskell
apache-2.0
20,596
import Control.Concurrent import Control.Exception import System.Posix main = do pid <- forkProcess $ do handle (\UserInterrupt{} -> putStrLn "caught") $ threadDelay 2000000 signalProcess sigINT pid threadDelay 2000000
mettekou/ghc
testsuite/tests/rts/T12903.hs
Haskell
bsd-3-clause
255
-- 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 DeriveAnyClass #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE NoReb...
facebookincubator/duckling
Duckling/Distance/Types.hs
Haskell
bsd-3-clause
3,600
{-# LANGUAGE TupleSections #-} module Value ( Infix(..), Value(..), Pattern(..), patVars, match, Env, Var(V), initialize, setVars, setPat, setPats, getVal, getVars, mapEnv ) where import Prelude hiding (showList) import Env (Var(V), getVars, mapEnv) import qualified Env (Env, initialize, setVars, setP...
YoshikuniJujo/toyhaskell_haskell
src/Value.hs
Haskell
bsd-3-clause
4,069
-- | -- Module : Data.Git.Pack -- License : BSD-style -- Maintainer : Vincent Hanquez <vincent@snarc.org> -- Stability : experimental -- Portability : unix -- module Data.Git.Pack ( PackedObjectInfo(..) , PackedObjectRaw -- * Enumerators of packs , packEnumerate -- * Helpers to process packs , packOpe...
Twinside/hit-simple
Data/Git/Pack.hs
Haskell
bsd-3-clause
5,767
{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE CPP #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE TupleSections #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE OverloadedStrings #-} {...
MichielDerhaeg/stack
src/Stack/Package.hs
Haskell
bsd-3-clause
58,229
{-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeSynonymInstances #-} module Network.Wai.Lens where import Control.Lens import Data.ByteString (ByteString) import Data.Foldable import Data.Monoid import ...
webcrank/wai-lens
src/Network/Wai/Lens.hs
Haskell
bsd-3-clause
3,201
module Day23.Test where import qualified Data.Map.Strict as M import Day23 import Test.Hspec tests :: SpecWith () tests = do describe "Part1" $ do it "Test1" $ do part1 M.empty 'a' test1 `shouldBe` 3 describe "Part2" $ do it "Test1" $ do part2 M.empty 'a' test1 `shouldBe` 3...
z0isch/aoc2016
test/Day23/Test.hs
Haskell
bsd-3-clause
321
module TTT.MinimaxSpec where import Control.Monad.State (evalState) import qualified Data.Map as M (empty) import Test.Hspec import TTT.Minimax (getMove) import TTT.Minimax.Internal (minimax) import TTT.GameState (GameState(..), Space(..), Token(..), availableMoves,initialState, makeMove, isWinFor, choose) playAllGa...
jcg3challenges/haskell_ttt
test/TTT/MinimaxSpec.hs
Haskell
bsd-3-clause
7,793
-- | Various functions module Misc.Stuff (fact,len) where -- | Calculates the fatorial fact :: Int -> Int fact 0 = 1 fact n = n * fact (n-1) -- | Calculates the length of a list len :: [a] -> Int len [] = 0 len (_:xs) = 1 + len xs
emaphis/Haskell-Practice
testing-project/src/Misc/Stuff.hs
Haskell
bsd-3-clause
235
{-# LANGUAGE TypeFamilies #-} {-| Module : Numeric.AERN.RealArithmetic.Basis.MPFR Description : Instances for MPFR as interval endpoints. Copyright : (c) Michal Konecny License : BSD3 Maintainer : mikkonecny@gmail.com Stability : experimental Portability : portable (i...
michalkonecny/aern
aern-mpfr/src/Numeric/AERN/RealArithmetic/Basis/MPFR.hs
Haskell
bsd-3-clause
2,914
module Problem14 ( p14 ) where import Data.List (maximum, maximumBy) import Data.Ord (comparing) collatz' :: Int -> Int -> Int collatz' i n | n == 1 = i | n `mod` 2 == 0 = collatz' (i + 1) $ n `div` 2 | otherwise = collatz' (i + 1) $ (3 * n) + 1 collatz :: Int -> Int collatz = collatz' 0 p14 = show . maxi...
anup-2s/project-euler
src/Problem14.hs
Haskell
bsd-3-clause
363
{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE FlexibleInstances, MultiParamTypeClasses #-} module Distribution.Nixpkgs.Haskell.Derivation ( Derivation, pkgid, revision, src, isLibrary, isExecutable , extraFunctionArgs, libraryDepends, executableDepend...
gridaphobe/cabal2nix
distribution-nixpkgs/src/Distribution/Nixpkgs/Haskell/Derivation.hs
Haskell
bsd-3-clause
6,944
{-# LANGUAGE GADTs #-} {-# LANGUAGE BangPatterns #-} {-# OPTIONS_GHC -fno-warn-incomplete-patterns #-} module CmmContFlowOpt ( cmmCfgOpts , cmmCfgOptsProc , removeUnreachableBlocksProc , replaceLabels ) where import GhcPrelude hiding (succ, unzip, zip) import Hoopl.Block import Hoopl.Collections i...
shlevy/ghc
compiler/cmm/CmmContFlowOpt.hs
Haskell
bsd-3-clause
16,886
{-# LANGUAGE GADTs #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE UndecidableInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} -- -- Copyright (c) 2009-2011, ERICSSON AB -- All rights reserved. -- -- Redistribution and use in source and binary forms,...
emwap/feldspar-language
src/Feldspar/Core/Constructs/Literal.hs
Haskell
bsd-3-clause
2,521
module Main where import Types import Game import AI import Control.Monad import Control.Monad.Random randIndex :: RandomGen r => Int -> Rand r Int randIndex len = getRandomR (0, len - 1) randMove :: RandomGen r => Game -> Rand r Move randMove g = do let ls = legalSquares g n = length ls idx <- randInde...
reedrosenbluth/othello
tests/Test.hs
Haskell
bsd-3-clause
1,232
{- Purely Functional Queue with Amortised Linear Cost Based on section 3 of Christoph Herrmann, Edwin Brady and Kevin Hammond. 2011. Dependently-typed Programming by Composition from Functional Building Blocks. In Draft Proceedings of the 12th International Symposium on Trends in Functional ...
adamgundry/inch
examples/Queue.hs
Haskell
bsd-3-clause
2,405
-------------------------------------------------------------------------------- -- | A store for storing and retreiving items {-# LANGUAGE ExistentialQuantification #-} {-# LANGUAGE ScopedTypeVariables #-} module Hakyll.Core.Store ( Store , Result (..) , toMaybe , new , set , get , de...
bergmark/hakyll
src/Hakyll/Core/Store.hs
Haskell
bsd-3-clause
5,742
module ScrabbleScoreKata.Day4Spec (spec) where import Test.Hspec import ScrabbleScoreKata.Day4 (score) spec :: Spec spec = do it "is zero when empty input" $ do score "" `shouldBe` 0 it "is 1 when given lowercase 'a'" $ do score "a" `shouldBe` 1 it "is...
Alex-Diez/haskell-tdd-kata
old-katas/test/ScrabbleScoreKata/Day4Spec.hs
Haskell
bsd-3-clause
1,071
{-# LANGUAGE DeriveDataTypeable, TypeFamilies #-} module Main where import Graphics.QML.Test.Framework import Graphics.QML.Test.Harness import Graphics.QML.Test.SimpleTest import Test.QuickCheck import Data.Proxy main :: IO () main = checkProperty $ TestType (Proxy :: Proxy SimpleMethods)
drhodes/HsQML
test/Test1.hs
Haskell
bsd-3-clause
293
{-# LANGUAGE Rank2Types #-} {-# LANGUAGE BangPatterns #-} {-# LANGUAGE OverloadedStrings #-} -- | -- Module : Data.String.Parse -- License : BSD-style -- Maintainer : Vincent Hanquez <vincent@snarc.org> -- Stability : experimental -- Portability : portable -- -- A very simple string parser related to Parsec...
NicolasDP/hop
Data/String/Parse.hs
Haskell
bsd-3-clause
6,100
----------------------------------------------------------------------------- -- | -- Module : Text.JSON.ToJSON -- Copyright : (c) Scrive 2011 -- License : BSD-style (see the LICENSE file in the distribution) -- -- Maintainer : mariusz@scrive.com -- Stability : development -- Portability : portable ...
scrive/fields-json
src/Text/JSON/ToJSValue.hs
Haskell
bsd-3-clause
2,157
module Validations where import Data.Text (Text) import qualified Data.Text as T (null) -- isAdult :: Monad m => Validator m String User isNotEmpty :: Text -> Bool isNotEmpty = not . T.null isPhone :: Text -> Bool isPhone _ = True
vyorkin-archive/assignment
api/src/Validations.hs
Haskell
mit
235
-- -- Data vault for metrics -- -- Copyright © 2013-2014 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. -- {-...
afcowie/vaultaire
tests/ContentsTest.hs
Haskell
bsd-3-clause
3,651
{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE PolyKinds #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE UndecidableInstances #-} {-# OPTIONS_GHC -Wno-orphans #-} -- | This module only exports orphan 'Store.Store' instances. Import as: -- -- @ -- import "...
k0001/haskell-money
safe-money-store/src/Money/Store.hs
Haskell
bsd-3-clause
3,699
module Tyckiting.AI.Timid (timidAI) where import Prelude () import Prelude.Compat import Control.Monad.Random (uniform) import Data.List (nub) import Data.Monoid (First (..)) import Tyckiting.Action import Tyckiting.AI import Tyckiting.Event import Tyckiting.Position import Tyckiting.Types...
vvmann/tyckiting-bot
clients/haskell/src/Tyckiting/AI/Timid.hs
Haskell
mit
1,869
{-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE DeriveFoldable #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE RankNTypes #-} {- | Module : Data.ML.Model Description : Model class. Copyright : (c) Paweł Nowak License : MIT Maintai...
bitemyapp/machine-learning
src/Data/ML/Model.hs
Haskell
mit
1,517
module Lint where import Control.Applicative import Data.List import Language.Haskell.HLint import Types lintSyntax :: Options -> String -> IO String lintSyntax opt file = pretty <$> lint opt file where pretty = unlines . map (intercalate "\0" . lines) lint :: Options -> String -> IO [String] lint opt file = m...
syohex/ghc-mod
Lint.hs
Haskell
bsd-3-clause
375
{- $Id: AFRPTestsPSwitch.hs,v 1.2 2003/11/10 21:28:58 antony Exp $ ****************************************************************************** * A F R P * * * * Module: ...
ony/Yampa-core
tests/AFRPTestsPSwitch.hs
Haskell
bsd-3-clause
9,592
<?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="sk-SK"> <title>DOM XSS Active Scan Rule | ZAP Extension</title> <maps> <homeID>top</homeID> ...
kingthorin/zap-extensions
addOns/domxss/src/main/javahelp/org/zaproxy/zap/extension/domxss/resources/help_sk_SK/helpset_sk_SK.hs
Haskell
apache-2.0
985
<?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="pt-BR"> <title>Highlighter</title> <maps> <homeID>highlighter</homeID> <mapref location...
thc202/zap-extensions
addOns/highlighter/src/main/javahelp/help_pt_BR/helpset_pt_BR.hs
Haskell
apache-2.0
964
#!/usr/bin/env runghc -- delink.hs import Text.Pandoc.JSON main = toJSONFilter delink delink :: Inline -> [Inline] delink (Link _ txt _) = txt delink x = [x]
heroxbd/SHTOOLS
src/pydoc/delink.hs
Haskell
bsd-3-clause
171
module Main where import System.Exit (ExitCode(..), exitSuccess, exitWith) import Control.Monad (unless, when) import Idris.AbsSyntax import Idris.CmdOptions import Idris.Error import Idris.Info.Show import Idris.Main import Idris.Options import Idris.Package import Util.System (setupBundledCC) processShowOptions ...
uuhan/Idris-dev
main/Main.hs
Haskell
bsd-3-clause
2,861
{-# LANGUAGE PolyKinds #-} module DepFail1 where data Proxy k (a :: k) = P z :: Proxy Bool z = P a :: Proxy Int Bool a = P
sdiehl/ghc
testsuite/tests/dependent/should_fail/DepFail1.hs
Haskell
bsd-3-clause
127
{-# LANGUAGE OverloadedStrings #-} module Yesod.Form.I18n.Norwegian where import Yesod.Form.Types (FormMessage (..)) import Data.Monoid (mappend) import Data.Text (Text) norwegianBokmålFormMessage :: FormMessage -> Text norwegianBokmålFormMessage (MsgInvalidInteger t) = "Ugyldig antall: " `mappend` t norwegianBokmålF...
meteficha/yesod
yesod-form/Yesod/Form/I18n/Norwegian.hs
Haskell
mit
1,671
-- !!! can't seek an AppendMode handle import System.IO import System.IO.Error main = do h <- openFile "hSeek004.out" AppendMode tryIOError (hSeek h AbsoluteSeek 0) >>= print
olsner/ghc
libraries/base/tests/IO/hSeek004.hs
Haskell
bsd-3-clause
181
{-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TypeFamilies #-} ------------------------------------------- -- | -- Module : Web.Stripe.Customer -- Copyright : (c) David Johnson, 2014 -- Maintainer : djohnson.m@gmail.com...
dmjio/stripe
stripe-core/src/Web/Stripe/Customer.hs
Haskell
mit
6,489
{-# LANGUAGE RankNTypes #-} -- Walking trees with coroutines. -- Based on: -- <http://okmij.org/ftp/continuations/ContExample.hs> module Tree where import Control.Delimited -- Binary trees data Tree a = Leaf | Node (Tree a) (Tree a) a deriving (Show, Eq) make_tree :: Int -> Tree Int make_tree j = go j 1 w...
thoughtpolice/hs-asai
examples/Tree.hs
Haskell
mit
970
module Y2016.M06.D14.Exercise where import Data.Matrix {-- Okay, so now that you have solved what the determinant of a matrix is (yesterday's exercise), today, let's solve what the inverse of a matrix is and, with that, solve a system of equations. There are multiple methods on how to invert a matrix. One approach ...
geophf/1HaskellADay
exercises/HAD/Y2016/M06/D14/Exercise.hs
Haskell
mit
1,311
module Standard where import Data.Monoid -- TODO: replace with more general version of myAnd that uses `Foldable` instead of [] -- See: https://hackage.haskell.org/package/base-4.9.0.0/docs/src/Data.Foldable.html# myAnd :: [Bool] -> Bool myAnd [] = True myAnd (True : xs) = myAnd xs myAnd (False : xs) = Fals...
JoshuaGross/haskell-learning-log
Code/Haskellbook/Standard.hs
Haskell
mit
2,176
import System.IO (openFile, hClose, IOMode(..)) import Options.Applicative import Data.ByteString.Lazy (ByteString) import Data.Binary (encode) import Data.Digest.CRC32 (crc32) import Control.Error (runScript, hoistEither, scriptIO) import qualified Data.ByteString.Lazy as B import Options -- PNG header has fixed siz...
ksaveljev/super-size-png
src/Main.hs
Haskell
mit
4,536
module Command.UpdateIndex ( Options , parserInfo , run ) where import Options.Applicative import Text.Read (step, readPrec) import qualified Blob data CacheInfoParams = NoCacheInfoParams | CacheInfoParams Int Blob.Id FilePath --instance Read CacheInfoParams where -- readPrec = do -- m <- step readPrec ...
danstiner/clod
src/Command/UpdateIndex.hs
Haskell
mit
1,830
module Prepare.Tanach.IndexParser where import Prelude hiding (Word) import Prepare.Xml.Parser (NodeParser, many, optional) import qualified Prepare.Xml.Parser as Xml import qualified Text.Megaparsec.Lexer as MP import Prepare.Tanach.IndexModel import Prepare.Tanach.TeiHeaderParser (teiHeader) verseCount :: NodePars...
ancientlanguage/haskell-analysis
prepare/src/Prepare/Tanach/IndexParser.hs
Haskell
mit
1,277
-- | This module holds the base data types and functions to interact with -- them. This is the lowest-level interface to interact with the datastore. module Database.Hasqueue.Core.Value ( -- * Base Types BucketID , ValueID ...
nahiluhmot/hasqueue
src/Database/Hasqueue/Core/Value.hs
Haskell
mit
1,583
import Data.Array ((!), Array, bounds, listArray) import Data.List (intercalate) import System.Random data Point = Point Double Double chaosGame :: RandomGen g => g -> Int -> Array Int (Point -> Point) -> [Point] chaosGame g n hutchinson = take n points where (x, g') = random g (y, g'') = random g' choi...
leios/algorithm-archive
contents/IFS/code/haskell/IFS.hs
Haskell
mit
890
module Unison.Util.Range where import Unison.Lexer (Pos(..)) -- | True if `_x` contains `_y` contains :: Range -> Range -> Bool _x@(Range a b) `contains` _y@(Range c d) = a <= c && d <= b overlaps :: Range -> Range -> Bool overlaps (Range a b) (Range c d) = a < d && c < b inRange :: Pos -> Range -> Bool inRange p (...
unisonweb/platform
parser-typechecker/src/Unison/Util/Range.hs
Haskell
mit
823
module Typecrawl.Process (processSite) where import Pipes import qualified Pipes.Prelude as P import Control.Monad (join) import Typecrawl.Types import Typecrawl.Scrapper import Typecrawl.Exporter -- | Starts the whole scrapping shenanigan. -- This could be severely improved, most likely by -- making scrapping more ...
Raveline/typecrawl
lib/Typecrawl/Process.hs
Haskell
mit
739
module Config( Arch(..), showArch, Program(..), Version, defaultVersion, source, dest, extractVersion ) where import Data.List.Extra import Development.Shake.FilePath import Data.Char data Arch = Arch32 | Arch64 showArch :: Arch -> String showArch Arch32 = "i386" showArch Arch64 = "x86_64" data...
fpco/minghc
Config.hs
Haskell
mit
1,801
{-# LANGUAGE MultiWayIf #-} {-# LANGUAGE OverloadedStrings #-} module Main where import Control.Monad import Data.List import System.Directory import System.FilePath import Util getAllUserDirs :: BuildMode -> IO [FilePath] getAllUserDirs bm = listDirectoryWithPrefix $ projectRootDir bm -- Project directories have n...
google/codeworld
codeworld-server/src/Migration.hs
Haskell
apache-2.0
2,207
module Dis8.Disassemble where import Common.Core import Common.Instr import Control.Applicative import Data.Bits import Data.List import Data.Maybe -- | Pretty-print a list of instructions starting at 0x200 showProg :: Program -> String showProg p = showProg' 0x200 (genLabels $ parseInstrs p) p where maxAddr = 0x...
jepugs/emul8
src/Dis8/Disassemble.hs
Haskell
apache-2.0
5,031
module Model where import Prelude import Yesod import Data.Text (Text) import Database.Persist.Quasi import OAuthToken share [mkPersist sqlSettings, mkMigrate "migrateAll"] $(persistFileWith lowerCaseSettings "config/models")
JanAhrens/yesod-oauth-demo
Model.hs
Haskell
bsd-2-clause
232
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE OverloadedStrings #-} module Main (main) where import Bucketeer.Persistence (storeBucketManager, restoreBuckets) import Bucketeer.Timers (startBucketManager) import Bucketeer.WebServer (BucketeerWeb(..), bucketeerServer) import Control.Appl...
MichaelXavier/Bucketeer
Bucketeer/WebServer/Main.hs
Haskell
bsd-2-clause
6,488
-- | Utility functions to generate Primitives module CLaSH.Primitives.Util where import Data.Aeson (FromJSON, Result (..), fromJSON, json) import qualified Data.Attoparsec.Lazy as L import Data.ByteString.Lazy (ByteString) import qualified Data.ByteString.Lazy as LZ import qualifi...
christiaanb/clash-compiler
clash-lib/src/CLaSH/Primitives/Util.hs
Haskell
bsd-2-clause
1,971