code stringlengths 5 1.03M | repo_name stringlengths 5 90 | path stringlengths 4 158 | license stringclasses 15
values | size int64 5 1.03M | n_ast_errors int64 0 53.9k | ast_max_depth int64 2 4.17k | n_whitespaces int64 0 365k | n_ast_nodes int64 3 317k | n_ast_terminals int64 1 171k | n_ast_nonterminals int64 1 146k | loc int64 -1 37.3k | cycloplexity int64 -1 1.31k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
{-# LANGUAGE OverloadedStrings, TypeFamilies, PackageImports, FlexibleContexts #-}
import Debug.Trace
import "monads-tf" Control.Monad.State
import Data.List
import Data.Pipe
import Data.HandleLike
import System.Environment
import System.IO.Unsafe
import Network
import qualified Data.ByteString as BS
import qualifie... | YoshikuniJujo/forest | subprojects/xmpipe/notls_pipe.hs | bsd-3-clause | 2,849 | 26 | 18 | 507 | 1,187 | 612 | 575 | 69 | 7 |
{-# LANGUAGE ScopedTypeVariables #-}
-- | callback for real-time subscriptions
module Handler.SubscriptionCallback where
import Import
import Instagram as IG
import Data.Aeson
import Network.Wai (requestHeaders)
import Data.Conduit
import Data.Conduit.List (consume)
import qualified Data.ByteString.Lazy as BSL
import... | prowdsponsor/ig-testapp | Handler/SubscriptionCallback.hs | bsd-3-clause | 1,572 | 0 | 16 | 286 | 371 | 192 | 179 | 34 | 3 |
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE BangPatterns, NoImplicitPrelude #-}
module GHC.Event.Thread
( getSystemEventManager
, getSystemTimerManager
, ensureIOManagerIsRunning
, ioManagerCapabilitiesChanged
, threadWaitRead
, threadWaitWrite
, threadWaitReadSTM
, threadWaitWriteSTM
... | jwiegley/ghc-release | libraries/base/GHC/Event/Thread.hs | gpl-3.0 | 13,360 | 0 | 25 | 3,039 | 2,960 | 1,508 | 1,452 | 247 | 5 |
{-|
Module : Kernel.TypeChecker
Description : Type checker
Copyright : (c) Daniel Selsam, 2016
License : GPL-3
Maintainer : daniel.selsam@gmail.com
API for type checker
-}
module Kernel.TypeChecker (
IndDecl(IndDecl), indDeclNumParams, indDeclLPNames, indDeclName, indDeclType, indDeclIntroRules
, Intro... | dselsam/tc | src/Kernel/TypeChecker.hs | gpl-3.0 | 728 | 0 | 5 | 119 | 124 | 84 | 40 | 24 | 0 |
rho :: (a, ()) -> a
rho (x, ()) = x | hmemcpy/milewski-ctfp-pdf | src/content/3.6/code/haskell/snippet16.hs | gpl-3.0 | 35 | 0 | 7 | 10 | 34 | 19 | 15 | 2 | 1 |
module WebParsing.ParseAll
(parseAll) where
import WebParsing.ArtSciParser (parseArtSci)
import WebParsing.UtsgJsonParser (getAllCourses)
parseAll :: IO ()
parseAll = do
parseArtSci
getAllCourses
| hermish/courseography | app/WebParsing/ParseAll.hs | gpl-3.0 | 211 | 0 | 6 | 34 | 52 | 29 | 23 | 8 | 1 |
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- |
-- Module : Main
-- Copyright : (c) 2013-2015 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>
-- Stability : auto-generated
-- Portability : non-portable (GHC extensions)
--
module Main (main)... | olorin/amazonka | amazonka-opsworks/test/Main.hs | mpl-2.0 | 537 | 0 | 8 | 103 | 76 | 47 | 29 | 9 | 1 |
-----------------------------------------------------------------------------
-- |
-- Module : Distribution.Simple.PreProcess
-- Copyright : (c) 2003-2005, Isaac Jones, Malcolm Wallace
-- License : BSD3
--
-- Maintainer : cabal-devel@haskell.org
-- Portability : portable
--
-- This defines a 'PreProces... | seereason/cabal | Cabal/Distribution/Simple/PreProcess.hs | bsd-3-clause | 28,085 | 0 | 30 | 8,018 | 5,628 | 3,062 | 2,566 | 429 | 40 |
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE ExistentialQuant... | iamkingmaker/HLearn | src/HLearn/Models/Classifiers/BayesOld.hs | bsd-3-clause | 5,042 | 0 | 15 | 1,197 | 1,363 | 743 | 620 | -1 | -1 |
module Data.API.Doc.Subst
( Dict
, subst
, prep
, mkDict
, extDict
)
where
import qualified Data.Map as Map
import Text.Regex
import Safe
type Dict = Map.Map String String
subst_re :: Regex
subst_re = mkRegexWithOpts "<<[a-zA-Z0-9_'-]+>>" True True
sub... | adinapoli/api-tools | src/Data/API/Doc/Subst.hs | bsd-3-clause | 940 | 0 | 14 | 294 | 321 | 174 | 147 | 26 | 2 |
-- |
-- Copyright : (c) Sam Truzjan 2013
-- License : BSD3
-- Maintainer : pxqr.sta@gmail.com
-- Stability : experimental
-- Portability : portable
--
-- Normally peer to peer communication consisting of the following
-- steps:
--
-- * In order to establish the connection between peers we ... | DavidAlphaFox/bittorrent | src/Network/BitTorrent/Exchange/Message.hs | bsd-3-clause | 40,749 | 553 | 15 | 9,193 | 7,178 | 4,152 | 3,026 | -1 | -1 |
module Language.Haskell.GhcMod.Boot where
import Control.Applicative
import Language.Haskell.GhcMod.Browse
import Language.Haskell.GhcMod.Flag
import Language.Haskell.GhcMod.Lang
import Language.Haskell.GhcMod.Monad
import Language.Haskell.GhcMod.Modules
-- | Printing necessary information for front-end booting.
boot... | cabrera/ghc-mod | Language/Haskell/GhcMod/Boot.hs | bsd-3-clause | 685 | 0 | 9 | 119 | 136 | 85 | 51 | 20 | 1 |
module Arguments where
import Control.Applicative ((<$>), (<*>), many, optional)
import qualified Data.List as List
import Data.Monoid ((<>), mconcat, mempty)
import Data.Version (showVersion)
import qualified Options.Applicative as Opt
import qualified Paths_elm_make as This
import qualified Text.PrettyPrint.ANSI.Lei... | mgold/elm-make | src/Arguments.hs | bsd-3-clause | 3,254 | 0 | 14 | 1,010 | 824 | 440 | 384 | 104 | 3 |
-- Name: Lens Example
-- Description: Shows an example of how to use lens.
import Control.Lens
import Data.Char
main :: IO ()
main = do
print $ ("hello","world")^._2
print $ set _2 42 ("hello","world")
print $ ("hello",("world","!!!"))^._2._1
print $ set (_2._1) 42 ("hello",("world","!!!"))
print $ "hello"^.... | filippovitale/eta-playground | lens-example/src/Main.hs | mit | 767 | 0 | 12 | 143 | 407 | 217 | 190 | -1 | -1 |
{-# OPTIONS_GHC -Wno-redundant-constraints -Wno-simplifiable-class-constraints #-}
{-# LANGUAGE MultiParamTypeClasses, TypeFamilies, GADTs,
ConstraintKinds, DataKinds, KindSignatures,
FlexibleInstances #-}
module T10195 where
import Data.Kind
data Foo m zp r'q = Foo zp
data Dict :: Constrai... | sdiehl/ghc | testsuite/tests/typecheck/should_compile/T10195.hs | bsd-3-clause | 897 | 0 | 11 | 210 | 295 | 154 | 141 | -1 | -1 |
{-
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998
\section{@Vars@: Variables}
-}
{-# LANGUAGE CPP, DeriveDataTypeable #-}
-- |
-- #name_types#
-- GHC uses several kinds of name internally:
--
-- * 'OccName.OccName': see "OccName#name_types"
--
-- * 'RdrName.RdrName': see ... | TomMD/ghc | compiler/basicTypes/Var.hs | bsd-3-clause | 15,361 | 0 | 11 | 4,200 | 2,542 | 1,424 | 1,118 | 213 | 1 |
{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses, TemplateHaskell #-}
module OverloadedLabelsRun04_A where
import GHC.OverloadedLabels
import Language.Haskell.TH
instance IsLabel x (Q [Dec]) where
fromLabel _ = [d| main = putStrLn "Ok" |]
| tjakway/ghcjvm | testsuite/tests/overloadedrecflds/should_run/OverloadedLabelsRun04_A.hs | bsd-3-clause | 248 | 0 | 8 | 32 | 47 | 29 | 18 | 6 | 0 |
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE NoImplicitPrelude
, BangPatterns
, NondecreasingIndentation
#-}
{-# OPTIONS_GHC -funbox-strict-fields #-}
-----------------------------------------------------------------------------
-- |
-- Module : GHC.IO.Encoding.Latin1
-- Copyright : (c) ... | beni55/haste-compiler | libraries/ghc-7.8/base/GHC/IO/Encoding/Latin1.hs | bsd-3-clause | 5,088 | 0 | 19 | 1,711 | 1,298 | 706 | 592 | 106 | 3 |
{-# LANGUAGE QuasiQuotes #-}
module Main where
parse = undefined
main :: IO ()
main = case () of
[parse||] -> return ()
_ -> return ()
| siddhanathan/ghc | testsuite/tests/quasiquotation/qq002/qq002.hs | bsd-3-clause | 155 | 0 | 9 | 47 | 57 | 32 | 25 | 7 | 2 |
module Nix.Evaluator.Builtins.Operators where
import Nix.Common
import Nix.Atoms
import Nix.Expr (NBinaryOp(..), NUnaryOp(..))
import Nix.Evaluator.Errors
import Nix.Evaluator.RuntimeTypes
import Nix.Values
import Nix.Values.NativeConversion
-- | Concatenation of lists.
binop_concat :: Monad m => WHNFValue m -> WHNFV... | adnelson/nix-eval | src/Nix/Evaluator/Builtins/Operators.hs | mit | 5,911 | 0 | 21 | 1,387 | 2,188 | 1,057 | 1,131 | -1 | -1 |
import Data.Ratio
import Primes
cornerNumbers :: Integer -> [Integer]
cornerNumbers sideLength
| sideLength `mod` 2 == 0 || sideLength<0 = error "Side length must be an odd integer"
| sideLength==1 = [1]
| otherwise = map (\n -> firstCorner-n*(sideLength-1)) [0..3]
where firstCorner = s... | arekfu/project_euler | p0058/p0058.hs | mit | 794 | 0 | 12 | 151 | 317 | 168 | 149 | 17 | 1 |
module FRP.Parser.Decl where
import Text.Parsec
import FRP.AST
import FRP.Parser.Lang
import FRP.Parser.Term
import FRP.Parser.Type
import Text.Parsec.Char (endOfLine)
decl :: Parser (Decl SourcePos)
decl = do
nam <- identifier
typ <- reservedOp ":" *> ty
_ <- string nam <* ws
params <- map (\x -> (x, Noth... | adamschoenemann/simple-frp | src/FRP/Parser/Decl.hs | mit | 505 | 0 | 14 | 103 | 203 | 103 | 100 | 17 | 1 |
import qualified Data.Map.Strict as Map
import Data.Maybe
values = Map.fromList([(1000, "M"), (900, "CM"), (500, "D"),
(400, "CD"), (100, "C"), (90, "XC"),
(50, "L"), (40, "XL"), (10, "X"),
(9, "IX"), (5, "V"), (4, "IV"), (1, "I")])
toRoman ::... | JonMidhir/RomanNumerals | toRoman.hs | mit | 640 | 0 | 9 | 193 | 268 | 156 | 112 | 15 | 1 |
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE RecordWildCards #-}
module Data.AppContainer.Types
( ImageManifest(..)
, ContainerRuntimeManifest(..)
, App(..)
, Dependency(..)
, EventHandler(..)
, Image(..)
, Label(..)
... | wereHamster/haskell-appc | src/Data/AppContainer/Types.hs | mit | 7,067 | 0 | 26 | 2,059 | 1,934 | 1,031 | 903 | 277 | 2 |
import Geometry
import qualified Geometry.Sphere as Sphere
import qualified Geometry.Cuboid as Cuboid
import qualified Geometry.Cube as Cube
demo1 = sphereVolume 5
demo1' = Sphere.volume 5
demo2 = sphereArea 5
demo2' = Sphere.area 5
demo3 = cuboidArea 1 2 3
demo3' = Cuboid.area 1 2 3
demo4 = cuboidVolume 1 2 ... | luisgepeto/HaskellLearning | 07 Modules/06_modules.hs | mit | 436 | 0 | 6 | 84 | 152 | 82 | 70 | 16 | 1 |
-- @Author: Zeyuan Shang
-- @Date: 2016-05-19 21:51:58
-- @Last Modified by: Zeyuan Shang
-- @Last Modified time: 2016-05-19 22:05:54
import Text.Parsec.String
import Text.Parsec hiding (Empty)
data Tree a = Empty | Branch a (Tree a) (Tree a)
deriving (Show, Eq)
pTree :: Parser (Tree Char)
pTree = pBranch <|>... | zeyuanxy/haskell-playground | ninety-nine-haskell-problems/vol7/68.hs | mit | 964 | 0 | 11 | 274 | 343 | 166 | 177 | 30 | 2 |
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE ViewPatterns #-}
module Handler.StackageHome
( getStackageHomeR
, getStackageDiffR
, getStackageCabalConfigR
, getDocsR
, ... | fpco/stackage-server | src/Handler/StackageHome.hs | mit | 6,429 | 0 | 19 | 1,759 | 1,570 | 734 | 836 | 138 | 5 |
module Kaos.Math.Real
where
-- This is a numeric type which is implemented in Haskell using floating point numbers, but which is held
-- abstract from the perspective of the DSL definitions. The intent is that DSL compilers may elect to use
-- different physical representations (fixed point, low precision floating poi... | dmcclean/kaos | src/Kaos/Math/Real.hs | mit | 584 | 0 | 6 | 96 | 40 | 26 | 14 | 3 | 0 |
-----------------------------------------------------------------------------
-- | Common utilities.
module Network.HTTP.Media.Utils
( breakChar
, trimBS
, mediaChars
, isMediaChar
, tokenChars
, isTokenChar
, isValidToken
) where
import qualified Data.ByteString.Char8 as BS
import ... | zmthy/http-media | src/Network/HTTP/Media/Utils.hs | mit | 2,518 | 0 | 11 | 459 | 438 | 262 | 176 | 31 | 1 |
{-# LANGUAGE CPP #-}
module GHCJS.DOM.CSSStyleSheet (
#if (defined(ghcjs_HOST_OS) && defined(USE_JAVASCRIPTFFI)) || !defined(USE_WEBKIT)
module GHCJS.DOM.JSFFI.Generated.CSSStyleSheet
#else
module Graphics.UI.Gtk.WebKit.DOM.CSSStyleSheet
#endif
) where
#if (defined(ghcjs_HOST_OS) && defined(USE_JAVASCRIPTFFI)) ||... | plow-technologies/ghcjs-dom | src/GHCJS/DOM/CSSStyleSheet.hs | mit | 450 | 0 | 5 | 39 | 33 | 26 | 7 | 4 | 0 |
problem_10 = sum (takeWhile (< 2000000) primes)
primes = 2 : filter(null . tail . primeFactors)[3,5..]
primeFactors n = factor n primes
where
factor n (p:ps)
|OA p*p > n = [n]
| n `mod` p == 0 = p : factor(n `div` p)(p:ps)
| otherwise = factor n ps
| ikemonn/haskellPractice | q10.hs | mit | 301 | 0 | 12 | 102 | 162 | 83 | 79 | 7 | 1 |
{-
Copyright (c) 2017 Lars Krueger
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, su... | LarsEKrueger/pandoc-vimwiki | src/Main.hs | mit | 8,065 | 0 | 23 | 1,687 | 2,498 | 1,259 | 1,239 | 169 | 2 |
module Test.Gravity where
import Linear.V2
import Linear.Vector
import Linear.Metric
import Data.Function (on)
import Control.Arrow (first, second)
-----------------------------------------------------------------------------
type Mass = Float
type Position = V2 Float
type Speed = V2 Float
data ObjectD = O... | fehu/hsgc | Test/Gravity.hs | mit | 4,833 | 0 | 17 | 1,376 | 869 | 489 | 380 | 57 | 2 |
func [True, False, True] = False
func [True, False, False] = False
func [True, True, True] = True
func [True, True, False] = False
func [False, False, False] = False
func [False, False, True] = True
func [False, True, False] = False
func [False, True, True] = True
combinations = [ [x1,x2,x3] | x1 <- [True,False], x2 <... | kirhgoff/haskell-sandbox | euler27/logic.hs | mit | 691 | 0 | 10 | 157 | 322 | 183 | 139 | 12 | 1 |
{-# LANGUAGE ImplicitParams, ExistentialQuantification #-}
module Text.LineToPDF.Internals where
import Data.IORef
import System.IO
import System.IO.Unsafe
import Control.Applicative
import qualified Data.ByteString.Lazy.Char8 as L
import qualified Data.IntMap as IM
{-# NOINLINE __POS__ #-}
__POS__ :: IORef Int
__POS... | audreyt/line2pdf | src/Text/LineToPDF/Internals.hs | mit | 15,176 | 0 | 42 | 4,876 | 3,736 | 1,920 | 1,816 | 417 | 6 |
module Examples.Search where
import Control.Effects.Eff
import Control.Effects.Search
import Control.Monad
prg1 :: Member (Search Int) r => Eff r (Int, Int)
prg1 = do
x <- choose [1,2]
when (x > 1) $ searchFail (T :: T Int)
y <- choose [3,4]
return (x,y)
prg1res = runPure $ handle (handleDFS :: Handler (Sea... | edofic/effect-handlers | test/Examples/Search.hs | mit | 443 | 0 | 11 | 88 | 215 | 113 | 102 | -1 | -1 |
module Command.Summary.Types (Envelope(Envelope)) where
data Envelope = Envelope Integer String Integer
| jpotterm/manila-hs | src/Command/Summary/Types.hs | cc0-1.0 | 106 | 0 | 6 | 13 | 29 | 18 | 11 | 4 | 0 |
{-# LANGUAGE ScopedTypeVariables, BangPatterns, TypeSynonymInstances, UndecidableInstances, FlexibleInstances #-}
-- | An experimental monadic interface to Tree mutation. The main idea is to
-- simulate IO-ish manipulation of real filesystem (that's the state part of
-- the monad), and to keep memory usage down by rea... | DavidAlphaFox/darcs | hashed-storage/Storage/Hashed/Monad.hs | gpl-2.0 | 11,703 | 0 | 15 | 3,521 | 3,355 | 1,716 | 1,639 | 205 | 4 |
module Compile where
import Syntax
import X86
import Control.Monad.State
--compile :: S -> [Instruction]
compileS e = evalState (compile' e) ([], identifiers) where
compile' :: S -> State ([String], [String]) (Operand, [Instruction])
compile' SKIP = do
i <- pop
push i
return (Label_R ... | orchid-hybrid/WHILE | Compile.hs | gpl-2.0 | 2,516 | 1 | 20 | 1,073 | 1,074 | 545 | 529 | -1 | -1 |
-- | Low level wrapping over System.Process
module Lib.Process (getOutputs, Env, CmdSpec(..)) where
import Control.Concurrent.Async
import Control.Exception (uninterruptibleMask)
import Control.Monad
import Data.Foldable (traverse_)
import Lib.Exception (bracket, finally)
import System.Environment (getEnv)
import Syst... | da-x/buildsome | src/Lib/Process.hs | gpl-2.0 | 2,920 | 0 | 22 | 569 | 664 | 367 | 297 | 52 | 1 |
module Library where
-- reusable function used in more than one place
import Control.Exception (catch, IOException)
import Control.Monad (forM)
import System.Random (randomRIO)
import Data.Array.IO (writeArray, IOArray, readArray, newListArray)
import System.IO (hSetEcho,stdin,hFlush, stdout)
import Data.Char (toUpper,... | ciderpunx/57-exercises-for-programmers | src/Library.hs | gpl-3.0 | 3,183 | 0 | 13 | 812 | 935 | 468 | 467 | 86 | 2 |
-- grid is a game written in Haskell
-- Copyright (C) 2018 karamellpelle@hotmail.com
--
-- This file is part of grid.
--
-- grid is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the Lice... | karamellpelle/grid | designer/source/Game/LevelPuzzleMode/LevelPuzzleWorld/OutputState/Fancy.hs | gpl-3.0 | 1,554 | 0 | 9 | 377 | 144 | 95 | 49 | 31 | 1 |
--Find the first occurence of a substring
--Approach is to leverage laziness by generating a list of all occurences of a substring and taking the head.
import Data.List (scanl)
import Safe (headMay)
beginsWith :: Eq a => [a] -> [a] -> Bool
beginsWith [] x = True
beginsWith x [] = False
beginsWith (x:xs) (y:ys) = x == ... | cem3394/EPI-Haskell | 07-14_firstOccurence.hs | gpl-3.0 | 679 | 0 | 11 | 155 | 298 | 156 | 142 | 15 | 1 |
module Construct where
import Helpers
import Data.Numbers.Primes
import Data.Maybe
import qualified Data.Vector as V
calcP :: Int -> Float -> [Int]
calcP p e =
let p' = (log $ convertInt p) ** (1+e)
lowBound = round (p'/2)
hightBound = floor p'
in filter isPrime [lowBound..hightBound]
calcS ::... | GOGEN/HashingCollizion | src/Utils/Construct.hs | gpl-3.0 | 853 | 18 | 16 | 204 | 407 | 215 | 192 | 24 | 1 |
{-# LANGUAGE FlexibleInstances, RecordWildCards #-}
module System.DevUtils.Redis.Helpers.Info.JSON (
Info(..),
keyspaces'toJSON
) where
import System.DevUtils.Redis.Helpers.Info.Include
import System.DevUtils.Redis.JSON
import qualified Data.ByteString as B
import qualified Data.Text as T
import Data.Aeson
instanc... | adarqui/DevUtils-Redis | src/System/DevUtils/Redis/Helpers/Info/JSON.hs | gpl-3.0 | 1,201 | 0 | 14 | 173 | 356 | 185 | 171 | 42 | 1 |
{-|
Module : ParseCelSpec
Description : Hspec tests for ParseCel
Copyright : (c) Huggable Monad, 2017
License : GPL-3
Maintainer : huggablemonad@hushmail.me
Stability : experimental
Portability : POSIX
This module provides Hspec tests for the 'ParseCel' module.
-}
{-# LANGUAGE OverloadedStrings #-}
mod... | emhoracek/smooch | app/tests/ParseCelSpec.hs | gpl-3.0 | 8,135 | 0 | 12 | 1,972 | 1,706 | 893 | 813 | 176 | 1 |
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
-- Module : Network.PagerDuty.REST.MaintenanceWindows
-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
-- License : This Source Code Form is subject t... | brendanhay/pagerduty | src/Network/PagerDuty/REST/MaintenanceWindows.hs | mpl-2.0 | 9,178 | 0 | 14 | 2,159 | 1,448 | 838 | 610 | -1 | -1 |
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators ... | brendanhay/gogol | gogol-cloudprivatecatalogproducer/gen/Network/Google/Resource/CloudPrivateCatalogProducer/Catalogs/Associations/List.hs | mpl-2.0 | 5,916 | 0 | 18 | 1,346 | 880 | 509 | 371 | 126 | 1 |
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators ... | rueshyna/gogol | gogol-compute/gen/Network/Google/Resource/Compute/Networks/List.hs | mpl-2.0 | 6,369 | 0 | 18 | 1,403 | 676 | 407 | 269 | 92 | 1 |
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators ... | brendanhay/gogol | gogol-storage/gen/Network/Google/Resource/Storage/ObjectAccessControls/Get.hs | mpl-2.0 | 5,539 | 0 | 19 | 1,280 | 728 | 426 | 302 | 111 | 1 |
{-# LANGUAGE ExistentialQuantification #-}
data Foo = forall a b . (Show a, Eq b) => Bar
{ foo :: a
, bars :: b
}
| lspitzner/brittany | data/Test61.hs | agpl-3.0 | 121 | 0 | 8 | 33 | 44 | 26 | 18 | 4 | 0 |
{-# OPTIONS_GHC -Wall #-}
module HW02_HC_LogAnalysis where
import Data.List (foldl', mapAccumR)
import HW02_Log
import System.IO.Unsafe (unsafePerformIO)
import qualified Test.HUnit as T
import qualified Test.HUnit.Util as U
------------------------------------------------... | haroldcarr/learn-haskell-coq-ml-etc | haskell/course/2014-06-upenn/cis194/src/HW02_HC_LogAnalysis.hs | unlicense | 11,997 | 0 | 21 | 3,023 | 2,989 | 1,542 | 1,447 | 127 | 3 |
-- learn.hs
module Learn where
-- First, we declare the name of our module so
-- it can be imported by name in a project.
-- We won't be doing a project of this size
-- for a while yet.
x = 10 * 5 + y
myResult = x + 5
y = 10
| aniketd/learn.haskell | haskellbook/learn.hs | unlicense | 229 | 0 | 6 | 59 | 36 | 23 | 13 | 4 | 1 |
module NTMEM (createTransport) where
import NT
import Control.Concurrent.Chan (Chan, newChan, readChan, writeChan)
import Control.Applicative ((<$>))
import Control.Category ((>>>))
import Control.Concurrent.MVar (MVar, newMVar, modifyMVar, modifyMVar_, readMVar)
import Control.Exception (throwIO)
import Control.Monad... | haroldcarr/learn-haskell-coq-ml-etc | haskell/playpen/plug/NTMEM.hs | unlicense | 4,178 | 0 | 20 | 1,039 | 1,194 | 635 | 559 | 70 | 2 |
--
-- 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/tests/ClientServerTest.hs | apache-2.0 | 5,928 | 0 | 18 | 1,627 | 1,447 | 739 | 708 | 104 | 7 |
module Foundation
( TicTacToe (..)
, TicTacToeRoute (..)
, TicTacToeMessage (..)
, resourcesTicTacToe
, Handler
, Widget
, module Yesod.Core
, module Settings
, StaticRoute (..)
, lift
, liftIO
) where
import Prelude
import Yesod.Core
import Yesod.Default.Config
import Y... | MichaelBaker/haskell-tictactoe | Foundation.hs | bsd-2-clause | 4,052 | 0 | 14 | 814 | 522 | 302 | 220 | -1 | -1 |
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Application
( withYiki
, withDevelAppPort
) where
import Foundation
import Settings
import Settings.StaticFiles (static)
import Yesod.... | masaedw/Yiki | Application.hs | bsd-2-clause | 2,764 | 0 | 15 | 556 | 515 | 278 | 237 | 51 | 1 |
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE FlexibleContexts, FlexibleInstances, TypeSynonymInstances #-}
{-# LANGUAGE OverlappingInstances, UndecidableInstances #-}
{-# LANGUAGE Mult... | pepeiborra/narradar | src/Narradar/Types/TRS.hs | bsd-3-clause | 19,256 | 0 | 17 | 5,384 | 7,501 | 3,853 | 3,648 | -1 | -1 |
module NPNTool.Liveness (
isLive) where
import NPNTool.PetriNet
import Data.Set (Set)
import qualified Data.Set as S
import Data.Graph.Inductive hiding (NodeMap)
import Data.Graph.Inductive.Query.DFS
isTerminal :: Graph gr => gr a b -> [Node] -> Bool
isTerminal g ns = all (not . hasOut . (flip match g)) ns
where... | co-dan/NPNTool | src/NPNTool/Liveness.hs | bsd-3-clause | 848 | 0 | 14 | 188 | 416 | 220 | 196 | 18 | 2 |
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}
module System.Win32.JunctionPoint
( createJunctionPoint
, deleteJunctionPoint
, getJunctionPointInfo
) where
import Control.Exception (bracket)
import Data.Bits
import Data.Char (chr)
import Data.Text (Text)
import qualified Data.Text as T
import... | mikesteele81/Win32-junction-point | System/Win32/JunctionPoint.hs | bsd-3-clause | 13,927 | 27 | 16 | 3,073 | 2,495 | 1,328 | 1,167 | -1 | -1 |
module Finance.Halifax.Ledger (outputLedger) where
import Finance.Halifax.Core
import Finance.Halifax.Options
import Finance.Halifax.Utilities
import System.IO
import System.Locale
import Control.Monad
import Data.List
import Data.Maybe
import Data.Time.Format
outputLedger :: Options -> Account -> [Transaction] -... | batterseapower/halifax-import | Finance/Halifax/Ledger.hs | bsd-3-clause | 1,744 | 0 | 13 | 338 | 426 | 223 | 203 | 34 | 2 |
module Benchmarks.SumPuz where
-- Cryptarithmetic solver from AFP 2003
import Data.List((\\))
import Data.Char(isAlpha, chr, ord)
import Data.Maybe(fromJust)
type Soln = [(Char, Int)]
solve :: String -> String
solve p =
display p (solutions xs ys zs 0 [])
where
[xs,ys,zs] = map reverse (words (filter (`notEle... | UoYCS-plasma/LazySmallCheck2012 | suite/performance/Benchmarks/SumPuz.hs | bsd-3-clause | 1,920 | 0 | 13 | 500 | 1,015 | 542 | 473 | 53 | 5 |
-- | Metropolis-adjusted Langevin diffusion. See, ex: Girolami and Calderhead
-- (2011):
--
-- http://onlinelibrary.wiley.com/doi/10.1111/j.1467-9868.2010.00765.x/abstract
module Strategy.MALA (mala, adaMala) where
import Control.Applicative
import Control.Monad
import Control.Monad.State.Strict
import Data.Maybe... | glutamate/probably-baysig | src/Strategy/MALA.hs | bsd-3-clause | 3,080 | 0 | 19 | 715 | 1,063 | 536 | 527 | 81 | 3 |
module Main where
import Control.Monad
import System.Process
interactIO :: (String -> IO String) -> IO ()
interactIO act = do
txt <- getContents
mapM_ (act >=> putStr) (lines txt)
-- TODO: this does no error handling whatsoever
processCommand :: String -> IO String
processCommand line =
case words line of
... | GaloisInc/saw-script | doc/tutorial/docode.hs | bsd-3-clause | 859 | 0 | 17 | 237 | 328 | 166 | 162 | 24 | 4 |
module Compiler.QbScript.CodeGen where
import Compiler.QbScript.AST
import Data.GH3.QB
import Control.Monad.Reader
import Control.Monad.State.Strict
import Data.ByteString(ByteString)
import Data.Packer
import Data.Word
packingBufferSize :: Int
packingBufferSize = 4096
genScriptCode :: QbScript -> ByteString
genScr... | adituv/qbscript | src/Compiler/QbScript/CodeGen.hs | bsd-3-clause | 13,113 | 0 | 18 | 2,903 | 4,927 | 2,273 | 2,654 | 405 | 5 |
module Triangulate(
triangulate
) where
import Linear
import Control.Lens
import qualified Graphics.Triangulation.Delaunay as D
import qualified Data.Vector.V2 as Vec
import qualified Data.Vector as V
import Data.Vector (Vector)
import Plane
import Debug.Trace
-- | Normalize coords of given vectors to fit [0 ... | Teaspot-Studio/model-gridizer | src/Triangulate.hs | bsd-3-clause | 1,495 | 0 | 15 | 328 | 604 | 322 | 282 | 31 | 2 |
{-# LANGUAGE QuasiQuotes #-}
import LiquidHaskell
import Language.Haskell.Liquid.Prelude (liquidError)
-- "Classic" GADT
--
-- data Expr a where
-- I :: Int -> Expr Int
-- B :: Bool -> Expr Bool
-- Eq :: Expr a -> Expr a -> Expr Bool
-- Pl :: Expr Int -> Expr Int -> Expr Int
--
-- eval :: Expr a -> a... | spinda/liquidhaskell | tests/gsoc15/unknown/pos/gadtEval.hs | bsd-3-clause | 2,522 | 0 | 8 | 829 | 505 | 286 | 219 | 40 | 1 |
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
-- Requires package 'derive'.
import Control.Applicative
import Data.Derive.Arbitrary
import Data.DeriveTH
import Test.QuickCheck
import Language.JavaScript.Parser
import Language.JavaScript.Parser.AST
import Debug.Trace
main :: IO ()
main = ... | alanz/language-javascript | quickcheck.hs | bsd-3-clause | 3,249 | 0 | 16 | 705 | 795 | 408 | 387 | 71 | 3 |
-----------------------------------------------------------------------------
-- |
-- Module : Text.CSL
-- Copyright : (c) Andrea Rossato
-- License : BSD-style (see LICENSE)
--
-- Maintainer : Andrea Rossato <andrea.rossato@unitn.it>
-- Stability : unstable
-- Portability : unportable
--
-- /citepr... | singingwolfboy/citeproc-hs | src/Text/CSL.hs | bsd-3-clause | 4,498 | 0 | 5 | 952 | 303 | 241 | 62 | 43 | 0 |
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module RBPCP.Handler.Internal.Error where
import MyPrelude
import Data.Aeson
import Data.Aeson.Types
import GHC.Generics
import qualified Network.Haskoin.Crypto as HC
import qualified PaymentChannel as PC
import qualified Data.Text as T
import qualified... | runeksvendsen/rbpcp-handler | src/RBPCP/Handler/Internal/Error.hs | bsd-3-clause | 1,844 | 0 | 9 | 369 | 445 | 252 | 193 | -1 | -1 |
{-# LANGUAGE OverloadedStrings, BangPatterns, ScopedTypeVariables #-}
module Main where
import System.Directory (doesFileExist)
import Control.Monad (forever)
import System.Exit (exitSuccess)
import System.Random (randomRIO)
import System.IO (hSetBuffering, stdout, BufferMode(..))
import Debug.Trace... | cirquit/pseudo-text | app/Main.hs | bsd-3-clause | 4,163 | 0 | 19 | 1,415 | 1,457 | 732 | 725 | 100 | 9 |
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE StandaloneDeriving #-}
module Coinbase.Exchange.Private.Test
( tests
, giveAwayOrder
, run_placeOrder
) where
import Control.Monad
import Control.Monad.IO.Class
import Control.Concurrent
import Data.IORef
import ... | AndrewRademacher/coinbase-exchange | test/Coinbase/Exchange/Private/Test.hs | mit | 10,209 | 0 | 18 | 4,278 | 1,730 | 873 | 857 | 139 | 7 |
-- MapCfg.hs; Mun Hon Cheong (mhch295@cse.unsw.edu.au) 2005
{-
reads the level configuration files and map media files
-}
module MapCfg where
import BSP
import Camera
import Control.Exception ( bracket )
import Data.HashTable (HashTable,lookup,insert,fromList,hashString)
import Data.IORef
import D... | snowmantw/Frag | src/MapCfg.hs | gpl-2.0 | 4,517 | 0 | 16 | 1,148 | 1,379 | 712 | 667 | 109 | 2 |
<?xml version='1.0' encoding='ISO-8859-1' ?>
<helpset version="1.0">
<!-- title -->
<title>JLS Help</title>
<!-- maps -->
<maps>
<homeID>top</homeID>
<mapref location="Map.jhm"/>
</maps>
<!-- views -->
<view>
<name>TOC</name>
<label>>Table of Contents</label>
<type>javax.help.TOCV... | kurmasz/JLS_explore | resources/help/JLSHelp.hs | gpl-3.0 | 567 | 59 | 43 | 92 | 275 | 141 | 134 | -1 | -1 |
{-# LANGUAGE CPP #-}
--
-- Copyright (C) 2005-2011 Stefan Wehr
--
-- Derived from: yi/Curses/UI.hs
-- Copyright (C) 2004 Don Stewart - http://www.cse.unsw.edu.au/~dons
-- Released under the GPL, granted permission to release this module
-- under the LGPL.
--
-- Derived from: riot/UI.hs
-- Copyright... | beni55/hscurses | UI/HSCurses/CursesHelper.hs | lgpl-2.1 | 14,733 | 0 | 16 | 3,707 | 3,429 | 1,880 | 1,549 | 269 | 17 |
-----------------------------------------------------------------------------
-- |
-- Module : AWS S3 Tests
-- Copyright : (c) Greg Heartsfield 2007
-- License : BSD3
--
-- Test hS3 library against Amazon S3. This requires the following
-- environment variables to be set with your Amazon keys:
-- AWS_A... | scsibug/hS3 | Tests.hs | bsd-3-clause | 15,935 | 0 | 22 | 6,368 | 3,211 | 1,581 | 1,630 | 279 | 1 |
{-|
SDL (Simple DirectMedia Layer) is a library for cross-platform development of
interactive applications. SDL provides routines for managing windows, rendering
graphics, processing sound, collecting input data, and much more. The Haskell
@sdl2@ library provides both a high- and low-level API to interface with
SDL. T... | bitemyapp/sdl2 | src/SDL.hs | bsd-3-clause | 3,790 | 0 | 6 | 755 | 145 | 96 | 49 | 24 | 0 |
module System.Console.Haskeline.Internal
( debugTerminalKeys ) where
import System.Console.Haskeline (defaultSettings, outputStrLn)
import System.Console.Haskeline.Command
import System.Console.Haskeline.InputT
import System.Console.Haskeline.LineState
import System.Console.Haskeline.Monads
import System.Console.H... | judah/haskeline | System/Console/Haskeline/Internal.hs | bsd-3-clause | 1,446 | 0 | 20 | 334 | 257 | 140 | 117 | 25 | 2 |
module Data.IGraph.Types where
import Data.Hashable
import Data.HashMap.Strict (HashMap)
import Data.HashSet as S (HashSet, foldr)
import Foreign.Ptr
import Foreign.ForeignPtr
import Data.IGraph.Internal.Constants
--------------------------------------------------------------------------------
-- C stuff
data Grph... | kaizhang/igraph | Data/IGraph/Types.hs | bsd-3-clause | 6,130 | 0 | 13 | 1,575 | 2,353 | 1,234 | 1,119 | -1 | -1 |
{-# LANGUAGE Haskell2010 #-}
{-# LINE 1 "dist/dist-sandbox-261cd265/build/System/Posix/Unistd.hs" #-}
{-# LINE 1 "System/Posix/Unistd.hsc" #-}
{-# LANGUAGE CApiFFI #-}
{-# LINE 2 "System/Posix/Unistd.hsc" #-}
{-# LANGUAGE NondecreasingIndentation #-}
{-# LINE 4 "System/Posix/Unistd.hsc" #-}
{-# LANGUAGE Safe #-}
{-# ... | phischu/fragnix | tests/packages/scotty/System.Posix.Unistd.hs | bsd-3-clause | 8,588 | 13 | 24 | 1,854 | 1,283 | 720 | 563 | -1 | -1 |
import Language.Haskell.Extension
import Distribution.Text
import Text.PrettyPrint
main = writeFile "src/Hint/Extension.hs" $ render moduleDoc
moduleDoc :: Doc
moduleDoc =
vcat [
text "-- this module was automatically generated. do not edit!",
text "-- edit util/mk_extensions_mod.hs instead",
text "modu... | int-e/hint | generate/mk_extensions_mod.hs | bsd-3-clause | 2,472 | 0 | 13 | 621 | 618 | 323 | 295 | 61 | 1 |
{-# LANGUAGE TypeSynonymInstances, FlexibleInstances #-}
{- |
Module : $Header$
Copyright : (c) Dominik Dietrich, DFKI Bremen 2010
License : GPLv2 or higher, see LICENSE.txt
Maintainer : dominik.dietrich@dfki.de
Stability : experimental
Portability : portable
-}
module Main where
import CSL.Sign... | keithodulaigh/Hets | CSL/Parse_Test.hs | gpl-2.0 | 8,512 | 0 | 18 | 1,611 | 1,865 | 948 | 917 | 136 | 3 |
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# L... | romanb/amazonka | amazonka-s3/gen/Network/AWS/S3/DeleteBucket.hs | mpl-2.0 | 2,884 | 0 | 9 | 660 | 364 | 220 | 144 | 49 | 1 |
{-# LANGUAGE BangPatterns #-}
{-# OPTIONS_GHC -O #-}
-- We always optimise this, otherwise performance of a non-optimised
-- compiler is severely affected
-- -----------------------------------------------------------------------------
--
-- (c) The University of Glasgow, 1997-2006
--
-- Character encodings
--
-- ----... | nomeata/ghc | compiler/utils/Encoding.hs | bsd-3-clause | 13,517 | 9 | 30 | 4,019 | 3,510 | 1,826 | 1,684 | -1 | -1 |
{-# LANGUAGE OverloadedStrings, DataKinds #-}
import Database.Cassandra.CQL
import Control.Monad
import Control.Monad.CatchIO
import Control.Monad.Trans (liftIO)
import Data.Int
import Data.ByteString.Char8 (ByteString)
import qualified Data.ByteString.Char8 as C
import Data.Set (Set)
import qualified Data.Set as S
im... | alphaHeavy/cassandra-cql | tests/test-set.hs | bsd-3-clause | 1,698 | 0 | 13 | 357 | 501 | 263 | 238 | 40 | 3 |
{-# language EmptyDataDecls, DeriveDataTypeable, DeriveFunctor #-}
module Graphics.Qt.Types where
import Data.Data
import Data.Binary
import Data.Abelian
import Data.Accessor
import Control.DeepSeq
import System.Random
import Utils
-- * Types
type QtInt = Int
type QtReal = Double -- unless running on ARM ;)
d... | nikki-and-the-robots/nikki | src/Graphics/Qt/Types.hs | lgpl-3.0 | 3,395 | 0 | 11 | 893 | 1,515 | 777 | 738 | -1 | -1 |
module LetIn1 where
--A definition can be lifted from a where or let to the top level binding group.
--Lifting a definition widens the scope of the definition.
--In this example, lift 'sq' in 'sumSquares'
--This example aims to test lifting a definition from a let clause to top level,
--and the elimination of the key... | SAdams601/HaRe | old/testing/liftToToplevel/LetIn1_TokOut.hs | bsd-3-clause | 501 | 0 | 8 | 133 | 99 | 52 | 47 | 7 | 1 |
{-# LANGUAGE ScopedTypeVariables, TypeOperators, DataKinds, PolyKinds,
TypeFamilies, GADTs, StandaloneDeriving #-}
module SplitWD where
import Data.Kind ( Type )
data Nat = Zero | Succ Nat
type family a + b where
Zero + b = b
Succ a + b = Succ (a + b)
infixl 6 +
data Vec :: Type -> Nat -> Type whe... | sdiehl/ghc | testsuite/tests/typecheck/should_compile/SplitWD.hs | bsd-3-clause | 1,690 | 0 | 13 | 450 | 574 | 311 | 263 | -1 | -1 |
{-| Implementation of handling of Allocation Solutions
-}
{-
Copyright (C) 2009, 2010, 2011, 2012, 2013, 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 ... | leshchevds/ganeti | src/Ganeti/HTools/Cluster/AllocationSolution.hs | bsd-2-clause | 10,861 | 0 | 18 | 2,913 | 1,996 | 1,106 | 890 | 160 | 3 |
module SafeLang13_A (IsoInt, h, showH, P, p, showP) where
newtype IsoInt = I Int
h :: IsoInt
h = I 2
showH :: String
showH = let I n = h
in show n
data P = P Int
p :: P
p = P 3
showP :: P -> String
showP (P n) = "Should be 3 := " ++ show n
| frantisekfarka/ghc-dsi | testsuite/tests/safeHaskell/safeLanguage/SafeLang13_A.hs | bsd-3-clause | 255 | 0 | 9 | 78 | 125 | 68 | 57 | 12 | 1 |
module PackageTests.TemplateHaskell.Check where
import PackageTests.PackageTester
import System.FilePath
import Test.Tasty.HUnit
vanilla :: SuiteConfig -> Assertion
vanilla config = do
let spec = PackageSpec
{ directory = "PackageTests" </> "TemplateHaskell" </> "vanilla"
, configOpts = []
... | enolan/cabal | Cabal/tests/PackageTests/TemplateHaskell/Check.hs | bsd-3-clause | 1,301 | 0 | 13 | 367 | 265 | 143 | 122 | 32 | 1 |
horner :: [Int] -> Int -> Int
horner [] _ = 1
horner (a:[]) _ = a
horner (a:b:l) p = horner ((a*p + b) : l) p
vals = ['0'..'9'] ++ ['a'..'z'] ++ ['A'..'Z']
topbase :: Int -> Int -> String
topbase p n = map (vals!!) $ mtopbase p n []
where mtopbase _ 0 l = l
mtopbase p n l = mtopbase p q (r:l)
... | lucas8/MPSI | ipt/recursive/conv/conv.hs | mit | 1,537 | 0 | 11 | 521 | 836 | 424 | 412 | 41 | 2 |
{-|
Module : RSA
Description : Module provides encryption and decryption of text in RSA cryptosystgem
Copyright : (c) Grzegorz Jasinski, Wojtek Chmielarz
License : MIT
-}
module RSA
(
encryptText
)
where
import Data.Char
-- | The 'getMaximumPower' function returns the largest p, where 2^p <= numb... | gjasinski/rsa-haskell | src/RSA.hs | mit | 1,907 | 0 | 13 | 468 | 448 | 233 | 215 | 24 | 1 |
-- Copyright 2015 Alvaro J. Genial (http://alva.ro) -- see LICENSE.md for more.
import Distribution.Simple
main = defaultMain
| ajg/base91 | Setup.hs | mit | 127 | 0 | 4 | 18 | 12 | 7 | 5 | 2 | 1 |
fibs :: [Integer]
fibs = 1 : scanl (+) 1 fibs
fibsN :: Int -> Integer
fibsN x = fibs !! x
fibs20 :: [Integer]
fibs20 = take 20 fibs
fibsLessThan100 :: [Integer]
fibsLessThan100 = takeWhile (\x -> x < 100) fibs
factorial :: [Integer]
factorial = scanl (*) 1 (iterate (+1) 1) | candu/haskellbook | ch10/scanExercises.hs | mit | 277 | 0 | 8 | 56 | 130 | 73 | 57 | 10 | 1 |
module Diamond (diamond) where
import Data.Char (ord, chr)
import Data.Text (Text, pack)
-- Very low-effort, since this is just the String solution with an extra pack.
-- This is mostly here to validate that the tests work with Char -> Maybe [Text],
-- rather than show off any use of Data.Text.
diamond :: Char -> May... | exercism/xhaskell | exercises/practice/diamond/.meta/examples/success-text/src/Diamond.hs | mit | 616 | 0 | 12 | 136 | 221 | 115 | 106 | 11 | 1 |
module Heap where
import Data.IntMap as M
--We need to define an association list type for use in our heap
--An association will be a tuple _associating_ the value of one type to the a
--stored value of another type.
type Assoc a b = [(a,b)]
aEmpty = []
--When lookup up a value in an association list, we want a de... | jmct/IterativeCompiler | frontend/Heap.hs | mit | 2,977 | 0 | 15 | 620 | 782 | 424 | 358 | 45 | 2 |
-- to run our new friend
-- save it as a .hs file
-- in terminal cd into the same dir
main = putStrLn "Hello World"
{- remember that Haskell is pure so it isn't running a function to print to the screen like we would if we were in a regular programming language.
Haskell functions cannot directly touch anything in... | HaskellForCats/HaskellForCats | IO/2014-0206IO.hs | mit | 1,100 | 12 | 9 | 224 | 359 | 181 | 178 | -1 | -1 |
module Spear.Math.Triangle
(
Triangle(..)
)
where
import Spear.Math.Vector
import Foreign.C.Types
import Foreign.Storable
data Triangle = Triangle
{ p0 :: {-# UNPACK #-} !Vector3
, p1 :: {-# UNPACK #-} !Vector3
, p2 :: {-# UNPACK #-} !Vector3
}
sizeVector3 = 3 * sizeOf (un... | jeannekamikaze/Spear | Spear/Math/Triangle.hs | mit | 841 | 0 | 11 | 287 | 255 | 132 | 123 | 23 | 1 |
module Feature.DeleteSpec where
import Test.Hspec
import Test.Hspec.Wai
import SpecHelper
import Network.HTTP.Types
spec :: Spec
spec = beforeAll resetDb
. around (withApp cfgDefault) $
describe "Deleting" $ do
context "existing record" $ do
it "succeeds with 204 and deletion count" $
request m... | NikolayS/postgrest | test/Feature/DeleteSpec.hs | mit | 1,158 | 0 | 19 | 331 | 266 | 137 | 129 | 29 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.