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 GeneratorSpec where
import TestImport
import qualified Data.Map as M
import Data.List.NonEmpty (NonEmpty(..))
type UserId = Int
type NonEmptyUserId = NonEmpty UserId
resources :: [ResourceTree String]
resources = [parseRoutes|
/api ApiP:
/users/#UserId UsersR GET
/users/#Int/foo UsersFooR GET
/u... | frontrowed/yesod-routes-flow | test/GeneratorSpec.hs | Haskell | mit | 5,708 |
module System.Logging.Facade.Types where
data LogLevel = TRACE | DEBUG | INFO | WARN | ERROR
deriving (Eq, Show, Ord, Bounded, Enum)
data Location = Location {
locationPackage :: String
, locationModule :: String
, locationFile :: String
, locationLine :: Int
, locationColumn :: Int
} deriving (Eq, Show)
data Lo... | beni55/logging-facade | src/System/Logging/Facade/Types.hs | Haskell | mit | 460 |
{-|
Module : TestPrint.Problen.BSP.CNF
Description : The CNF type Printer tests
Copyright : (c) Andrew Burnett 2014-2015
Maintainer : andyburnett88@gmail.com
Stability : experimental
Portability : Unknown
The Test Tree Node for the CNF type's Printer Tests
-}
module TestPrint.Problem.BSP.CNF (
printer, --... | aburnett88/HSat | tests-src/TestPrint/Problem/BSP/CNF.hs | Haskell | mit | 867 |
{-# LANGUAGE OverloadedStrings #-}
module Web.Twitter.PleaseCaption.Status ( getExtendedEntities
, hasPhotoEntities
, hasAltText
, asText
) where
import Data.... | stillinbeta/pleasecaption | src/Web/Twitter/PleaseCaption/Status.hs | Haskell | mit | 1,169 |
module TruthTable.Entry where
import TruthTable.Logic
import TruthTable.Parser
import TruthTable.Printing
import System.Environment
import Data.List
entry :: IO ()
entry = getArgs >>= return . intercalate " " >>=
putStrLn . printResultOrErrorWithDefaultConfig .
genTruthTable . parseGrammar . lex... | tjakway/truth-table-generator | src/TruthTable/Entry.hs | Haskell | mit | 323 |
{- Alec Snyder
- hw 10 Globber Test Suite
- github repo: https://github.com/allonsy/globber
-}
module Main (main) where
import Test.Hspec
import Globber
main :: IO ()
main = hspec $ describe "Testing Globber" $ do
describe "empty pattern" $ do
it "matches empty string" $
matchGlob "" "" `shouldBe... | allonsy/globber | TestGlobber.hs | Haskell | mit | 2,210 |
module Tyle.Parsers where
import Text.Parsec
import Text.Parsec.Char
import Text.Parsec.String
import Text.Parsec.Combinator
import Control.Monad (liftM)
import Tyle.Grammar
lambda :: Parser String
lambda = choice $ map string [ "lambda"
, "\\"
, "\955"
... | gambogi/tyle | Tyle/Parsers.hs | Haskell | mit | 1,188 |
{-# htermination enumFromThen :: () -> () -> [()] #-}
| ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/full_haskell/Prelude_enumFromThen_2.hs | Haskell | mit | 54 |
-- Getting the last element from a list of n numbers using recursion
my_last n = if length n == 0
then (error "Empty list has no end defined")
else if length n == 1
then head []
else my_last (tail n)
main = print (my_last [1,2,3,4])
| creativcoder/recurse | 99Problems/last_element.hs | Haskell | mit | 285 |
-----------------------------------------------------------------------------
--
-- Module : Drool.UI.GLWindow
-- Copyright : Tobias Fuchs
-- License : AllRightsReserved
--
-- Maintainer : twh.fuchs@gmail.com
-- Stability : experimental
-- Portability : POSIX
--
-- |
--
-----------------------------... | fuchsto/drool | src/Drool/UI/GLWindow.hs | Haskell | mit | 15,073 |
import System.IO
-- For now, only takes one line
-- Curried function, predicate (Char -> Bool) on String results in List of Strings
splitBy :: (Char -> Bool) -> String -> [String]
-- p is predicate, s is string
-- dropWhile is the remains of taking while (takeWhile) p is satisfied
splitBy p s = case dropWhile p s of... | michaelx11/multilingo | StringOperations/src/splitBySpace.hs | Haskell | mit | 929 |
module Examples.Reader where
import Control.Effects.Eff
import Control.Effects.Reader
import Control.Effects.Exception
prg1 = ask
prg1run x = runPure . handle (readerHandler x)
prg1res :: Int -> Int
prg1res x = prg1run x prg1
| edofic/effect-handlers | test/Examples/Reader.hs | Haskell | mit | 231 |
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE ScopedTypeVariables #-}
{- | This module exports a class 'Groups' that policy modules
must define an instance of to define groups, or mappings
between a group 'Principal'and the principals in the group.
An app may then relabel a labeled value by using 'labelRewrite'.
-}
modu... | scslab/hails | Hails/PolicyModule/Groups.hs | Haskell | mit | 4,087 |
{-# LANGUAGE OverloadedStrings #-}
module Main where
-- import Lib
-- main :: IO ()
-- main = someFunc
import Control.Applicative
import App
main :: IO ()
main = run | DominikDitoIvosevic/yafebe | back/app/Main.hs | Haskell | apache-2.0 | 170 |
module Main where
import MonteCarloGui
main :: IO ()
main = monteCarloGui
| alexandersgreen/alex-haskell | MonteCarloPi/Main.hs | Haskell | apache-2.0 | 76 |
-- | The fully-qualified HaskellExpr representation of some functions from base.
module Data.HaskellExpr.Base where
import Data.HaskellExpr
eId :: HaskellExpr (a -> a)
eId = qualified "Prelude" "id"
eConst :: HaskellExpr (a -> b -> a)
eConst = qualified "Prelude" "const"
eFlip :: HaskellExpr ((a -> b -> c) -> b ->... | gelisam/hawk | src/Data/HaskellExpr/Base.hs | Haskell | apache-2.0 | 627 |
{-# OPTIONS -fglasgow-exts #-}
-----------------------------------------------------------------------------
{-| Module : QStyleHintReturn.hs
Copyright : (c) David Harley 2010
Project : qtHaskell
Version : 1.1.4
Modified : 2010-09-02 17:02:35
Warning : this file is machine generated -... | uduki/hsQt | Qtc/Enums/Gui/QStyleHintReturn.hs | Haskell | bsd-2-clause | 6,376 |
-----------------------------------------------------------------------------
-- |
-- Module : Data.SBV.Compilers.C
-- Copyright : (c) Levent Erkok
-- License : BSD3
-- Maintainer : erkokl@gmail.com
-- Stability : experimental
--
-- Compilation of symbolic programs to C
------------------------------... | dylanmc/cryptol | sbv/Data/SBV/Compilers/C.hs | Haskell | bsd-3-clause | 39,515 |
{-# OPTIONS_GHC -Wall #-}
{-# LANGUAGE TupleSections #-}
module Algw.Infer where
import Algw.Ast
import Algw.Type
import Algw.Env
import State
import Data.IORef
import Data.Maybe
import Control.Monad
import qualified Data.Map as M
import qualified Data.Set as S
makeNewVar :: Infer (Infer TName)
makeNewVar =
do r <... | zjhmale/HMF | src/Algw/Infer.hs | Haskell | bsd-3-clause | 3,788 |
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
module Mismi.SQS.Core.Data (
QueueName (..)
, Queue (..)
, QueueUrl (..)
, MessageId (..)
) where
import Mismi.Kernel.Data (MismiRegion)
import P
-- Queue names are limited to 80 characters. Alphanumeric characters... | ambiata/mismi | mismi-sqs-core/src/Mismi/SQS/Core/Data.hs | Haskell | bsd-3-clause | 867 |
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE DataKinds #-} -- these two needed for help output
{-# LANGUAGE TypeOperators #-}
module Types where
import Data.Hashable
import qualified Data.HashMap.Strict as H
import Data.Csv hiding (look... | VDBWRAIR/Haskell-MAAPs | src/Types.hs | Haskell | bsd-3-clause | 2,660 |
module Stream
( tests -- :: Int -> Tests
) where
import Control.Monad
import Data.Bits
import Data.ByteString (ByteString)
import qualified Data.ByteString as S
import Crypto.Encrypt.Stream
import Crypto.Key
import Crypto.Nonce... | thoughtpolice/hs-nacl | tests/Stream.hs | Haskell | bsd-3-clause | 1,246 |
module Network.Email.Parser
( -- | Encodings
quotedPrintable
, base64
, crlfText
, -- | Mail
headers
, mail
) where
import Prelude hiding (takeWhile)
import Data.List hiding (takeWhile)
import Data.Maybe
import Data.Monoid
import Control.Applicative
import Co... | abbradar/email | src/Network/Email/Parser.hs | Haskell | bsd-3-clause | 4,533 |
-- |
-- Copyright : Anders Claesson 2013-2016
-- Maintainer : Anders Claesson <anders.claesson@gmail.com>
--
-- Components of permutations.
--
module Sym.Perm.Component
(
components
, skewComponents
, leftMaxima
, leftMinima
, rightMaxima
, rightMinima
) where
import Foreign
impo... | akc/sym | Sym/Perm/Component.hs | Haskell | bsd-3-clause | 2,272 |
#define IncludedcatIndices
#ifdef IncludedmakeIndicesNull
#else
#include "../Proofs/makeIndicesNull.hs"
#endif
#ifdef IncludedmergeIndices
#else
#include "../Proofs/mergeIndices.hs"
#endif
#ifdef IncludedconcatMakeIndices
#else
#include "../Proofs/concatMakeIndices.hs"
#endif
catIndices :: RString ->... | nikivazou/verified_string_matching | src/Proofs/catIndices.hs | Haskell | bsd-3-clause | 1,558 |
{-
(c) The GRASP/AQUA Project, Glasgow University, 1992-2006
\section[RnEnv]{Environment manipulation for the renamer monad}
-}
{-# LANGUAGE CPP #-}
module ETA.Rename.RnEnv (
newTopSrcBinder,
lookupLocatedTopBndrRn, lookupTopBndrRn,
lookupLocatedOccRn, lookupOccRn, lookupOccRn_maybe,
... | alexander-at-github/eta | compiler/ETA/Rename/RnEnv.hs | Haskell | bsd-3-clause | 81,249 |
{-# OPTIONS_GHC -W #-}
module Type.Inference where
import qualified Data.Map as Map
import qualified Type.Type as T
import qualified Type.Environment as Env
import qualified Type.Constrain.Expression as TcExpr
import qualified Type.Solve as Solve
import SourceSyntax.Module as Module
import SourceSyntax.Annotation (n... | deadfoxygrandpa/Elm | compiler/Type/Inference.hs | Haskell | bsd-3-clause | 2,377 |
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE OverloadedStrings #-}
module Lazyfoo.Lesson15 (main) where
import Control.Applicative
import Control.Monad
import Data.Foldable
import Data.Monoid
import Data.Maybe
import Foreign.C.Types
import Linear
import Linear.A... | svenkeidel/sdl2 | examples/lazyfoo/Lesson15.hs | Haskell | bsd-3-clause | 4,292 |
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANG... | achirkin/easytensor | easytensor/src/Numeric/Subroutine/Sort.hs | Haskell | bsd-3-clause | 9,742 |
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeFamilies #-}
-- |
-- Module : Data.Array.Repa.Mutable
-- Copyright : (c) Geoffrey Mainland 2012
-- License : BSD-style
--
-- Maintainer : Geoffrey Mainland <mainland@apeiron.net>
-- Stability : experimental
-- Portability : non-portable
--
-- This m... | mainland/nikola | src/Data/Array/Repa/Mutable.hs | Haskell | bsd-3-clause | 1,025 |
-- typeInference2.hs
module TypeInference2 where
f x y = x + y + 3
| renevp/hello-haskell | src/typeInference2.hs | Haskell | bsd-3-clause | 67 |
{-# OPTIONS_GHC -Wall #-}
{-# LANGUAGE CPP #-}
module Language.Sh.Glob ( expandGlob, matchPattern,
removePrefix, removeSuffix ) where
import Control.Monad.Trans ( MonadIO )
import Control.Monad.State ( runState, put )
import Data.List ( isPrefixOf, partition )
import Data.Maybe ( isJust, list... | shicks/shsh | Language/Sh/Glob.hs | Haskell | bsd-3-clause | 12,285 |
import Data.Array
import Data.List
import Data.Ord (comparing)
syrs n = a
where
a = listArray (1,n) $ 0:[1 + syr n x | x <- [2..n]]
syr n x = if x' <= n then a ! x' else 1 + syr n x'
where
x' = if even x then x `div` 2 else 3 * x + 1
main = print $ maximumBy (comparin... | dterei/Scraps | euler/p14/p14_mem.hs | Haskell | bsd-3-clause | 352 |
module PTS.Syntax.Algebra
( PreAlgebra
, Algebra
, fold
, strip
, allvars
, allvarsAlgebra
, freevars
, freevarsAlgebra
, freshvar
, depZip
) where
import Data.Set (Set)
import qualified Data.Set as Set
import PTS.Syntax.Names
import PTS.Syntax.Term
-- algebras
type PreAlgebra alpha beta
= Te... | Toxaris/pts | src-lib/PTS/Syntax/Algebra.hs | Haskell | bsd-3-clause | 1,900 |
module Main where
import Prelude hiding ((+),(-))
import System.Environment
import DeepGADT
import IO
main = do
args <- getArgs
let [inImg,outImg] = args
img1 <- readImgAsVector inImg
newImg <- printTimeDeep (run ((integer 30) + (blurY (blurX (image img1)))))
writeVectorImage outImg newImg
| robstewart57/small-image-processing-dsl-implementations | haskell/small-image-processing-dsl/app/deep-gadt/prog5.hs | Haskell | bsd-3-clause | 314 |
{-|
Module : Database.Test.MultiConnect
Copyright : (c) 2004 Oleg Kiselyov, Alistair Bayley
License : BSD-style
Maintainer : oleg@pobox.com, alistair@abayley.org
Stability : experimental
Portability : non-portable
Tests Database.Enumerator code in the context of multiple
database connectio... | bagl/takusen-oracle | Database/Test/MultiConnect.hs | Haskell | bsd-3-clause | 1,200 |
-----------------------------------------------------------------------------
-- |
-- Module : Tuura.Plato.Translate.Translation
-- Copyright : (c) 2015-2018, Tuura authors
-- License : BSD (see the file LICENSE)
-- Maintainer : jonathan.r.beaumont@gmail.com
-- Stability : experimental
--
-- Plato is a tool wh... | tuura/concepts | src/Tuura/Plato/Translate/Translation.hs | Haskell | bsd-3-clause | 8,661 |
module Dotnet.System.Xml.XmlProcessingInstruction where
import Dotnet
import qualified Dotnet.System.Xml.XmlLinkedNode
import Dotnet.System.Xml.XmlWriter
import Dotnet.System.Xml.XmlNode
import Dotnet.System.Xml.XmlNodeType
data XmlProcessingInstruction_ a
type XmlProcessingInstruction a = Dotnet.System.Xml.XmlLinked... | alekar/hugs | dotnet/lib/Dotnet/System/Xml/XmlProcessingInstruction.hs | Haskell | bsd-3-clause | 2,475 |
{-# LANGUAGE BangPatterns #-}
foo = case v of !(x : xs) -> x
| mpickering/hlint-refactor | tests/examples/Structure19.hs | Haskell | bsd-3-clause | 61 |
{-
BackendCommon: Common code used by most backends
Part of Flounder: a message passing IDL for Barrelfish
Copyright (c) 2007-2010, ETH Zurich.
All rights reserved.
This file is distributed under the terms in the attached LICENSE file.
If you do not find this file, copies can be found by writin... | utsav2601/cmpe295A | tools/flounder/BackendCommon.hs | Haskell | mit | 18,497 |
module HN.Curl where
import Network.Curl
-- | Download a string from a URI.
downloadString :: String -> IO (Either (CurlCode,String) String)
downloadString uri = do
withCurlDo $ do
(code,resp) <- curlGetString_ uri opts
case code of
CurlOK -> return (Right resp)
_ -> return (Left (code,resp))
... | lwm/haskellnews | src/HN/Curl.hs | Haskell | bsd-3-clause | 462 |
<?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="id-ID">
<title>Encode/Decode/Hash Add-on</title>
<maps>
<homeID>encoder</homeID>
<mapre... | thc202/zap-extensions | addOns/encoder/src/main/javahelp/org/zaproxy/addon/encoder/resources/help_id_ID/helpset_id_ID.hs | Haskell | apache-2.0 | 974 |
{-# LANGUAGE TypeOperators #-}
-- #2993
module T2993 where
foo b a = a <**> b . b
| sdiehl/ghc | testsuite/tests/rename/should_fail/T2993.hs | Haskell | bsd-3-clause | 86 |
module HAD.Y2014.M03.D18.Exercise where
-- $setup
-- >>> import Data.Maybe
-- >>> let backPartner = (>>= partner) . (>>= partner)
data Person a = Single a | Married a (Person a)
partner :: Person a -> Maybe (Person a)
partner (Married _ p) = Just p
partner _ = Nothing
get :: Person a -> a
get (Single x) = x
get ... | 1HaskellADay/1HAD | exercises/HAD/Y2014/M03/D18/Exercise.hs | Haskell | mit | 975 |
{-# LANGUAGE CPP, OverloadedStrings #-}
module LoadCache where
import Haxl.Core
import ExampleDataSource
#include "LoadCache.txt"
| GaussDing/Haxl | tests/LoadCache.hs | Haskell | bsd-3-clause | 132 |
module Distribution.Client.Dependency.Modular.Validate (validateTree) where
-- Validation of the tree.
--
-- The task here is to make sure all constraints hold. After validation, any
-- assignment returned by exploration of the tree should be a complete valid
-- assignment, i.e., actually constitute a solution.
impor... | enolan/cabal | cabal-install/Distribution/Client/Dependency/Modular/Validate.hs | Haskell | bsd-3-clause | 12,175 |
{-# LANGUAGE TypeFamilies, GeneralizedNewtypeDeriving #-}
module ShouldCompile where
import Control.Applicative (Applicative)
data family S a
newtype instance S Int = S Int
deriving Eq
data family S2 a b
newtype instance S2 Int b = S2 (IO b)
deriving (Functor, Appl... | snoyberg/ghc | testsuite/tests/indexed-types/should_compile/DerivingNewType.hs | Haskell | bsd-3-clause | 337 |
{-# OPTIONS_GHC -XLiberalTypeSynonyms #-}
module ShouldCompile where
type T a b = a
type S m = m ()
f :: S (T Int)
f = undefined
| urbanslug/ghc | testsuite/tests/typecheck/should_compile/tc234.hs | Haskell | bsd-3-clause | 136 |
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Floating
( floating
) where
import Fractional (fractional)
import System.Random (Random)
import Test.QuickCheck.Checkers (EqProp, (=-=), inverseL)
import Test.QuickCheck.Extra (UnitInterval(..), Tiny(..), BiunitInterval)
import... | expipiplus1/exact-real | test/Floating.hs | Haskell | mit | 3,332 |
import Data.List (foldl1')
import Math.NumberTheory.Primes.Testing (isPrime)
--import Control.Parallel.Strategies (using, parList, rseq)
-- isPrime :: Integer -> Bool
-- isPrime n
-- | n < 2 = False
-- | n == 2 = True
-- | otherwise =
-- let sqn = (floor (sqrt (fromIntegral n))) + 1
-- in and [ n `mod... | feliposz/project-euler-solutions | haskell/euler27.hs | Haskell | mit | 1,153 |
-- ($) :: (a -> b) -> a -> b
-- f $ x = f x
-- f a b c === (((f a) b) c)
test1 = sum (map sqrt [1..130])
test2 = sum $ map sqrt [1..130]
test3 = sqrt (3 + 4 + 9)
test4 = sqrt $ 3 + 4 + 9
test5 = sum (filter (> 10) (map (*2) [2..10]))
test6 = sum $ filter (> 10) (map (*2) [2..10])
test7 = sum $ filter (> 10) $ map (... | v0lkan/learning-haskell | session-archive/007-dollar.hs | Haskell | mit | 377 |
main = putStrLn "สวัสดีครับ"
| merxer/kata | haskell/14.hs | Haskell | mit | 49 |
{-# LANGUAGE TupleSections #-}
module SoOSiM.Components.ResourceManager.Behaviour where
import Control.Arrow (first,second)
import Data.Char (toLower)
import qualified Data.HashMap.Strict as HashMap
import Data.List (mapAccumL,intersect,(\\),partition)
import So... | christiaanb/SoOSiM-components | src/SoOSiM/Components/ResourceManager/Behaviour.hs | Haskell | mit | 2,912 |
module Unison.Typechecker.Components (components, minimize, minimize') where
import Data.Bifunctor (first)
import qualified Data.Graph as Graph
import qualified Data.Map as Map
import Data.Maybe
import Data.Set (Set)
import qualified Data.Set as Set
import qualified Unison.ABT as ABT
import ... | paulp/unison | parser-typechecker/src/Unison/Typechecker/Components.hs | Haskell | mit | 3,618 |
{-# LANGUAGE OverloadedStrings, QuasiQuotes #-}
module Y2017.M11.D27.Exercise where
{--
Okay, we have a set of recommended articles, now we want to add some new
articles to the list. So, given an article id as a basis and a set of article
ids to add, add those articles to the source article's recommended list.
Yes:... | geophf/1HaskellADay | exercises/HAD/Y2017/M11/D27/Exercise.hs | Haskell | mit | 1,299 |
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TemplateHaskell #-}
module TimeUnitsJSONInstance where
import Data.Aeson.TH ... | joe9/streaming-betfair-api | src/TimeUnitsJSONInstance.hs | Haskell | mit | 1,044 |
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TupleSections #-}
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotanalytics-dataset-deltatime.html
module Stratosphere.ResourceProperties.IoTAnalyticsDatasetDeltaTime where... | frontrowed/stratosphere | library-gen/Stratosphere/ResourceProperties/IoTAnalyticsDatasetDeltaTime.hs | Haskell | mit | 2,243 |
module Main where
import Filter.Abstract (abstract)
import Filter.Attr (simplifyAttr)
import Filter.Bib (bibliography)
import Filter.Float (float)
import Filter.Hyperref (hyperref)
import Filter.LinksAsNotes (linksAsNotes)
import Filter.Macros (processMacros)
import Filter.MultiBib (multibib)
import Filter.Multicol (m... | Thhethssmuz/ppp | src/Main.hs | Haskell | mit | 2,510 |
-- Paradigme de programare, laboratorul 2: functii recursive
-- 1. Factorialul unui număr dat, fără restricții și tail recursive.
--
-- TDA-ul număr se aseamănă cu TDA-ul listă:
-- - 0 (caz de bază) <- 0! = 1
-- - n (pas de inducție) <- n! = n * (n - 1)!
factorial 0 = 1
factorial n = n * factorial (n - 1)
-- Cum se ... | spyked/slides | misc-notes/pp-cb-labs/lab-02/lab-02.hs | Haskell | cc0-1.0 | 8,319 |
-- Project Euler Problem 30 - digit fifth powers
--
-- sum all numbers that are the sum of the fifth powers of their digits
--
-- (does not include 1)
--
import Data.List
import Data.Char
digits x = [ digitToInt y | y <- (show x)]
p5dsum x = sum [ y^5 | y <- digits x]
max_possible = (9^5)*10 -- assuming no more tha... | yunwilliamyu/programming-exercises | project_euler/p030_digit_fifth_powers.hs | Haskell | cc0-1.0 | 468 |
module Problem011 where
main = do str <- readFile "problem-011.txt"
let xs = map (read :: String -> Int) $ words str
print $ maximum $ [prod xs is | i <- [0..400], o <- offsets, let is = map (+ i) o, last is < 400]
offsets = [[0, 1, 2, 3]
,[0,20,40,60]
,[0,21,42,63]
,... | vasily-kartashov/playground | euler/problem-011.hs | Haskell | apache-2.0 | 384 |
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DeriveGeneric #-}
module Main where
import Data.Monoid
import Data.String
import Web.Spock.Safe
import Data.Aeson
import GHC.Generics
main :: IO ()
data User = User { name :: String, height :: Int } deriving Generic
instance ToJSON User
main =
runSpock 8080 $ spo... | justinholmes/haskell-playground | src/Main.hs | Haskell | apache-2.0 | 491 |
<?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="ru-RU">
<title>Form Handler | ZAP Extension</title>
<maps>
<homeID>top</homeID>
<mapref... | secdec/zap-extensions | addOns/formhandler/src/main/javahelp/org/zaproxy/zap/extension/formhandler/resources/help_ru_RU/helpset_ru_RU.hs | Haskell | apache-2.0 | 973 |
module AlecSequences.A271328Spec (main, spec) where
import Test.Hspec
import AlecSequences.A271328 (a271328)
main :: IO ()
main = hspec spec
spec = describe "A271328" $
it "correctly computes the first 20 elements" $
take 20 (map a271328 [1..]) `shouldBe` expectedValue where
expectedValue = [1,5,10,17,28,... | peterokagey/haskellOEIS | test/AlecSequences/A271328Spec.hs | Haskell | apache-2.0 | 377 |
module Web.Socdiff.Github.Github where
import Control.Applicative
import qualified Data.Text as T
import Haxl.Core
import Web.Socdiff.Github.DataSource
-- | Fetch a list of followers for the given username
getFollowers :: T.Text -> GenHaxl u [T.Text]
getFollowers u = dataFetch (GetFollowers u)
-- | Fetch a list of r... | relrod/socdiff | src/Web/Socdiff/Github/Github.hs | Haskell | bsd-2-clause | 785 |
module GTKMainWindow where
import GTKContext
import Control.Monad.Trans
import Control.Monad.Trans.Reader
import qualified GI.Gtk as Gtk
setupMainWindow :: ReaderT GTKContext IO ()
setupMainWindow = do
o <- gtkGetObj Gtk.Window "window1"
_ <- liftIO $ Gtk.widgetShow o
_ <- liftIO $ Gtk.onWidgetDestroy o Gtk.... | nbrk/ld | executable/GTKMainWindow.hs | Haskell | bsd-2-clause | 342 |
import Network.Wai.Handler.Snap
import Controller
main :: IO ()
main = putStrLn "Loaded" >> withLounge (run 3000)
| fortytools/lounge | snap-server.hs | Haskell | bsd-2-clause | 116 |
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
module HERMIT.Dictionary.Function
( externals
, appArgM
, buildAppM
, buildAppsM
, buildCompositionT
, buildFixT
, buildIdT
, staticArgR
, staticArgPosR
, staticArgPredR
, stat... | beni55/hermit | src/HERMIT/Dictionary/Function.hs | Haskell | bsd-2-clause | 9,522 |
module REPL.REPL
(
repl
) where
import System.IO (hFlush, stdout)
import Control.Monad (when)
import System.Exit (exitSuccess)
import Data.Char (toLower)
import Rating
import REPL.Commands
import REPL.Exit
import REPL.List
import REPL.NPC
import REPL.Set
import REPL.Unset
import REPL.Lock
impor... | sandmark/AlbanKnights | src/REPL/REPL.hs | Haskell | bsd-3-clause | 1,203 |
module Purescript.Ide.CodecJSON where
import Purescript.Ide.Externs (ExternDecl(..))
import Data.Aeson
instance ToJSON ExternDecl where
toJSON (FunctionDecl n t) = object ["name" .= n, "type" .= t]
toJSON (ModuleDecl n t) = object ["name" .= n, "type" .= t]
toJSON (DataDecl n t) = obj... | passy/psc-ide | lib/Purescript/Ide/CodecJSON.hs | Haskell | bsd-3-clause | 526 |
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeApplications #-}
module HaskellCI.Config.ConstraintSet where
import HaskellCI.Prelude
import qualified Distribution.FieldGrammar as C
import HaskellCI.Newtypes
import HaskellCI.OptionsGrammar
data ConstraintSet = ConstraintSe... | hvr/multi-ghc-travis | src/HaskellCI/Config/ConstraintSet.hs | Haskell | bsd-3-clause | 1,838 |
-- Compiler Toolkit: finite maps
--
-- Author : Manuel M. T. Chakravarty
-- Created: 23 March 95
--
-- Version $Revision: 1.12 $ from $Date: 2003/04/16 11:11:46 $
--
-- Copyright (c) [1995..2000] Manuel M. T. Chakravarty
--
-- This file is free software; you can redistribute it and/or modify
-- it under the term... | mwotton/ctkl | src/Text/CTK/FiniteMaps.hs | Haskell | bsd-3-clause | 16,301 |
import GL
import Compile0
example :: GCM ()
example = do
a <- createPort :: GCM (Port Int)
b <- createPort
component $ do
assert $ val a === val b + 1
output a "a"
output b "b"
| GRACeFUL-project/DSL-WP | deliverables/d4.3/test.hs | Haskell | bsd-3-clause | 194 |
{-|
Module : Idris.Core.Evaluate
Description : Evaluate Idris expressions.
Copyright :
License : BSD3
Maintainer : The Idris Community.
-}
{-# LANGUAGE BangPatterns, DeriveGeneric, FlexibleInstances,
MultiParamTypeClasses, PatternGuards #-}
{-# OPTIONS_GHC -fwarn-incomplete-patterns #-}
module... | ben-schulz/Idris-dev | src/Idris/Core/Evaluate.hs | Haskell | bsd-3-clause | 52,168 |
module Codec.Crypto.DSA(
module Codec.Crypto.DSA.Exceptions
)
where
import Codec.Crypto.DSA.Exceptions
| GaloisInc/DSA | src/Codec/Crypto/DSA.hs | Haskell | bsd-3-clause | 121 |
--
-- 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.
--
{-# LANGUAGE OverloadedStrings ... | glasnt/selecto | src/Selecto/NagiosSearch.hs | Haskell | bsd-3-clause | 2,187 |
{-# LANGUAGE CPP #-}
{-# LANGUAGE TemplateHaskell #-}
module Test.Async.IO
( ioTestGroup
) where
import Control.Monad (when, void)
import Data.Maybe (isJust, isNothing)
import Control.Concurrent.Lifted
import Control.Exception.Lifted as E
#if MIN_VERSION_monad_control(1, 0, 0)
import Control.Concurrent.Async.Lift... | dmjio/lifted-async | tests/Test/Async/IO.hs | Haskell | bsd-3-clause | 2,374 |
module CodeGeneration.CodeGenerator (generateCode) where
import Control.Monad.Reader
import Control.Monad.Writer
import Tree.HtmlTree
import CodeGeneration.JavascriptCode
import qualified Data.Map as Map
type CodeGeneration = WriterT String (Reader JavascriptCode) ()
-- | Generate the JS code to creat... | sergioifg94/Hendoman | src/CodeGeneration/CodeGenerator.hs | Haskell | bsd-3-clause | 2,414 |
module Horbits.Orbit (module X, module Horbits.Orbit)
where
import Control.Lens
import Horbits.Body
import Horbits.Orbit.Class as X
import Horbits.Orbit.Data as X
import Horbits.Orbit.Geometry as X
import Horbits.Orbit.Position as X
import ... | chwthewke/horbits | src/horbits/Horbits/Orbit.hs | Haskell | bsd-3-clause | 481 |
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE DeriveDataTypeable #-}
module Harihara.Options
( parseOptions
, HariharaOptions (..)
, HariharaException (..)
) where
import Control.Exception
import Data.Foldable (foldrM)
import qualified Data.Set as S
import Data.Typeable (Typeable())
import System.Console.Ge... | kylcarte/harihara | src/Harihara/Options.hs | Haskell | bsd-3-clause | 4,324 |
{-# LANGUAGE
OverloadedStrings
#-}
module Application where
import Web.Routes.Nested
import Network.HTTP.Types
defApp :: Application
defApp _ respond = respond (textOnlyStatus status404 "404 Not Found")
| athanclark/clark-mining-tech | src/Application.hs | Haskell | bsd-3-clause | 213 |
module Test.Collision (testCollision) where
import Test.Framework
import Test.Framework.Providers.QuickCheck2
import Test.QuickCheck
import Data.List hiding (insert)
import Collision
import Environment
import Test.ArbitraryInstances
testCollision =
testGroup "Collision" [testProperty "same result as naive" pNaive]... | alexisVallet/haskell-shmup | Test/Collision.hs | Haskell | bsd-3-clause | 872 |
{-# LANGUAGE FlexibleContexts #-}
module LogMan.Processor
( run
) where
import Control.Monad.State
import LogMan.Filters
import LogMan.LogEntry
import LogMan.LogFile
import LogMan.Options
import LogMan.Output
processEntries :: (MonadIO m, MonadState Options m) => [String] -> m ()
processEntries n = do
es <... | cwmunn/logman | src/LogMan/Processor.hs | Haskell | bsd-3-clause | 500 |
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE DeriveFunctor #-}
module Parser241.Parser.ProductionRule.Internal.Manager where
import Parser241.Parser.ProductionRule.Internal.Maker
import Control.Monad.Writer (Writer(..), runWriter, tell, MonadWriter(..))
import Parser24... | YLiLarry/parser241-production-rule | src/Parser241/Parser/ProductionRule/Internal/Manager.hs | Haskell | bsd-3-clause | 1,721 |
-- Copyright 2021 Google LLC
--
-- Use of this source code is governed by a BSD-style
-- license that can be found in the LICENSE file or at
-- https://developers.google.com/open-source/licenses/bsd
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LAN... | google-research/dex-lang | src/lib/Err.hs | Haskell | bsd-3-clause | 17,510 |
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
module Signal.Core.Stream where
import Control.Monad.Operational.Compositional
import Control.Applicative
import Control.Monad
import Prelude ((.), ($))
--------------------------------------------------------------------------------
-- * Streams
-----... | markus-git/signal | src/Signal/Core/Stream.hs | Haskell | bsd-3-clause | 1,276 |
module Sound.Synthesis (module X) where
import Sound.Synthesis.Amplitude as X
import Sound.Synthesis.Combinator as X
import Sound.Synthesis.Constant as X
import Sound.Synthesis.Envelope as X
import Sound.Synthesis.Frequency as X
import Sound.Synthesis.Interval as X
import Sound.Synthesis.Type as X
import Sound.Synthesi... | pskrz/Synthesis | src/Sound/Synthesis.hs | Haskell | bsd-3-clause | 366 |
module OpenCV.Unsafe
( unsafeCoerceMat
, unsafeCoerceMatM
-- * Mutable Matrix
, unsafeFreeze
, unsafeThaw
, unsafeRead
, unsafeWrite
) where
import "base" Foreign.Storable ( Storable, peek, poke )
import "primitive" Control.Monad.Primitive
( PrimMonad, PrimState, unsafePrimToPrim ... | Cortlandd/haskell-opencv | src/OpenCV/Unsafe.hs | Haskell | bsd-3-clause | 1,043 |
-- | The main prover loop.
{-# LANGUAGE RecordWildCards, MultiParamTypeClasses, GADTs, BangPatterns, OverloadedStrings, ScopedTypeVariables, GeneralizedNewtypeDeriving, PatternGuards, TypeFamilies #-}
module Twee where
import Twee.Base
import Twee.Rule hiding (normalForms)
import qualified Twee.Rule as Rule
import Twe... | nick8325/kbc | src/Twee.hs | Haskell | bsd-3-clause | 25,575 |
type Matrix a = [Row a]
type Row a = [a]
type Grid = Matrix Digit
type Digit = Char
digits :: [Char]
digits = ['1' .. '9']
blank :: Digit -> Bool
blank = (== '0')
solve :: Grid -> [Grid]
solve = filter valid . completions
completions :: Grid -> [Grid]
completions d = []
valid :: Grid -> Bool
valid d = False
| trymilix/cookbooks | Software/haskell/sudoku.hs | Haskell | apache-2.0 | 316 |
module EditWebhook where
import Github.Repos.Webhooks
import qualified Github.Auth as Auth
import Github.Data.Definitions
main :: IO ()
main = do
let auth = Auth.OAuth "oauthtoken"
let editWebhookDef = EditRepoWebhook {
editRepoWebhookRemoveEvents = Just [WebhookWildcardEvent],
editRepoWebhookAddE... | jwiegley/github | samples/Repos/Webhooks/EditWebhook.hs | Haskell | bsd-3-clause | 839 |
module Jana.ErrorMessages where
import Text.Printf
import Jana.Error
import Jana.Ast
aliasError :: Ident -> Ident -> Message
aliasError id1 id2 = Message $
printf "Identifiers `%s' and `%s' are aliases" (ident id1) (ident id2)
unboundVar :: String -> Message
unboundVar name = Message $
printf "Variable `%s' ha... | mbudde/jana | src/Jana/ErrorMessages.hs | Haskell | bsd-3-clause | 4,465 |
{-# LANGUAGE Haskell98 #-}
{-# LINE 1 "Data/Text/Internal/Encoding/Fusion.hs" #-}
{-# LANGUAGE BangPatterns, CPP, Rank2Types #-}
-- |
-- Module : Data.Text.Internal.Encoding.Fusion
-- Copyright : (c) Tom Harper 2008-2009,
-- (c) Bryan... | phischu/fragnix | tests/packages/scotty/Data.Text.Internal.Encoding.Fusion.hs | Haskell | bsd-3-clause | 7,791 |
-- | Create a bundle to be uploaded to Stackage Server.
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
module Stackage.ServerBundle
( serverBundle
, epochTime
, bpAllPackages
, docsListing
) where
import qualified Codec.Archive.Tar a... | myfreeweb/stackage | Stackage/ServerBundle.hs | Haskell | mit | 4,251 |
{-
Copyright 2015 Google Inc. 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://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or a... | Ye-Yong-Chi/codeworld | codeworld-base/src/GHC/Exception.hs | Haskell | apache-2.0 | 741 |
module WaiAppStatic.Types
( -- * Pieces
Piece
, toPiece
, fromPiece
, unsafeToPiece
, Pieces
, toPieces
-- * Caching
, MaxAge (..)
-- * File\/folder serving
, FolderName
, Folder (..)
, File (..)
, LookupResult (..)
, Listing
-- * Settings
, St... | sordina/wai | wai-app-static/WaiAppStatic/Types.hs | Haskell | bsd-2-clause | 5,370 |
{-# LANGUAGE RankNTypes #-}
module Main (main) where
import Common (commonMain)
import Control.DeepSeq
import Control.Monad.Identity
import qualified Control.Monad.Trans.Reader as R
import qualified Control.Monad.Trans.State.Strict as S
import Criterion.Main
import Data.Monoid
import Pipes
import Pipes.Lift
defaultMa... | FranklinChen/Haskell-Pipes-Library | benchmarks/LiftBench.hs | Haskell | bsd-3-clause | 2,050 |
{-# OPTIONS -w #-}
module Plugin.Free.Theorem where
import Plugin.Free.Type
import Plugin.Free.Expr
import Plugin.Free.Util
data Theorem
= ThForall Var Type Theorem
| ThImplies Theorem Theorem
| ThEqual Expr Expr
| ThAnd Theorem Theorem
deriving (Eq,Show)
precIMPLIES, precAND ... | zeekay/lambdabot | Plugin/Free/Theorem.hs | Haskell | mit | 6,106 |
{-
(c) The University of Glasgow 2006
(c) The AQUA Project, Glasgow University, 1993-1998
This is useful, general stuff for the Native Code Generator.
Provide trees (of instructions), so that lists of instructions
can be appended in linear time.
-}
module OrdList (
OrdList,
nilOL, isNilOL, unitOL, a... | shlevy/ghc | compiler/utils/OrdList.hs | Haskell | bsd-3-clause | 3,258 |
<?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="fa-IR">
<title>Alert Filters | ZAP Extension</title>
<maps>
<homeID>top</homeID>
<mapre... | thc202/zap-extensions | addOns/alertFilters/src/main/javahelp/org/zaproxy/zap/extension/alertFilters/resources/help_fa_IR/helpset_fa_IR.hs | Haskell | apache-2.0 | 974 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.