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 Vector where
data Vec = V !Int !Int deriving (Show, Eq)
instance Num Vec where
V x1 y1 + V x2 y2 = V (x1+x2) (y1+y2)
V x1 y1 - V x2 y2 = V (x1-x2) (y1-y2)
V x1 y1 * V x2 y2 = V (x1*x2) (y1*y2)
abs (V x y) = V (abs x) (abs y)
signum (V x y) = V (signum x) (signum y)
fromInteger x = V (fromInteger x)... | cobbpg/dow | src/Vector.hs | Haskell | bsd-3-clause | 337 |
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE NoImplicitPrelude #-}
module Ircbrowse.View.Template where
import Ircbrowse.View
import Ircbrowse.Types.Import
import qualified Text.Blaze.Html5 as H
import Data.Text (Text)
template :: AttributeValue -> Text -> Html -> Html -> Html
te... | chrisdone/ircbrowse | src/Ircbrowse/View/Template.hs | Haskell | bsd-3-clause | 3,220 |
--------------------------------------------------------------------------------
-- |
-- Module : Graphics.Rendering.OpenGL.Raw.Compatibility31
-- Copyright : (c) Sven Panne 2015
-- License : BSD3
--
-- Maintainer : Sven Panne <svenpanne@gmail.com>
-- Stability : stable
-- Portability : portable
--
... | phaazon/OpenGLRaw | src/Graphics/Rendering/OpenGL/Raw/Compatibility31.hs | Haskell | bsd-3-clause | 38,287 |
module Scheme.DataType (
module Scheme.DataType.Misc,
EvalError, ScmError, TryError,
Expr(..),
ScmCode(..), ScmFile,
Var(..),
Return(..), ReturnE,
Name, AFunc, WAFunc, RFunc, Proc, Synt,
Scm, runScm,
ScmEnv, ScmStates, ScmRef,
MetaInfo(..), Config(..), setConfig, setMSP,
... | ocean0yohsuke/Scheme | src/Scheme/DataType.hs | Haskell | bsd-3-clause | 9,162 |
{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, TypeFamilies #-}
module Rubik.Turn where
import Data.Array
import Rubik.Negate as N
import Rubik.Key
data Turn = NoTurn | Clock | OneEighty | CounterClock
deriving (Eq,Ord,Show,Enum,Ix)
instance Negate Turn where
negate NoTurn = NoTurn
n... | andygill/rubik-solver | src/Rubik/Turn.hs | Haskell | bsd-3-clause | 1,481 |
{-# LANGUAGE FlexibleInstances #-}
-- ghc options
{-# OPTIONS_GHC -Wall #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
-- {-# OPTIONS_GHC -fno-warn-name-shadowing #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
-- {-# OPTIONS_GHC -fno-warn-missing-signatures #-}
-- {-# OPTIONS_GHC -fno-warn-unused-do-bind #-}
-- {... | reuleaux/pire | src/Pire/Pretty/Nm.hs | Haskell | bsd-3-clause | 1,331 |
class X where
foo :: Int
-- | Y
-- Y is something
-- nice.
class Y where
bar :: Int
| itchyny/vim-haskell-indent | test/comment/before_blank_line_and_class.out.hs | Haskell | mit | 91 |
{-# 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... | meditans/haskell-webapps | doc/docs/opaleye/code/opaleye-select-with-records-and-restrict.hs | Haskell | mit | 1,804 |
module Verifier.SAW.SATQuery
( SATQuery(..)
, SATResult(..)
, satQueryAsTerm
) where
import Control.Monad (foldM)
import Data.Map (Map)
import Data.Set (Set)
import Verifier.SAW.Name
import Verifier.SAW.FiniteValue
import Verifier.SAW.SharedTerm
-- | This datatype represents a satisfiability query that might
-- be... | GaloisInc/saw-script | saw-core/src/Verifier/SAW/SATQuery.hs | Haskell | bsd-3-clause | 2,474 |
{-# LANGUAGE OverloadedStrings, TupleSections #-}
-- | Parser components for the ROS message description language (@msg@
-- files). See http://wiki.ros.org/msg for reference.
module Parse (parseMsg, parseSrv, simpleFieldAssoc) where
import Prelude hiding (takeWhile)
import Control.Applicative
import Control.Arrow ((&&&... | bitemyapp/roshask | src/executable/Parse.hs | Haskell | bsd-3-clause | 7,585 |
module FunIn3 where
--The application of a function is replaced by the right-hand side of the definition,
--with actual parameters replacing formals.
--In this example, unfold 'addthree'.
--This example aims to test the elimination of extra parentheses when unfolding
--a function defintion.
main :: Int -> Int
main =... | mpickering/HaRe | old/testing/unfoldDef/FunIn3_TokOut.hs | Haskell | bsd-3-clause | 469 |
module StrategoAST2(module AST) where
import StrategoPattern as AST
import StrategoTerm as AST
import StrategoType as AST
import StrategoProp as AST
import StrategoDecl as AST
| forste/haReFork | tools/hs2stratego/AST/StrategoAST2.hs | Haskell | bsd-3-clause | 176 |
module ShowRepoEvents where
import qualified Github.Issues.Events as Github
import Data.List (intercalate)
import Data.Maybe (fromJust)
main = do
possibleEvents <- Github.eventsForRepo "thoughtbot" "paperclip"
case possibleEvents of
(Left error) -> putStrLn $ "Error: " ++ show error
(Right events) -... | bitemyapp/github | samples/Issues/Events/ShowRepoEvents.hs | Haskell | bsd-3-clause | 1,783 |
module Lib where
import Data.Function (on)
import Data.List (findIndices, minimumBy, transpose)
import Data.Maybe (isJust, isNothing)
data Shape = Nought | Cross
deriving (Read, Show, Eq)
type Cell = Maybe Shape
type Board = [Cell]
boardSize = 3
emptyBoard = replicate (boardSize * boardSize) Nothing
makeBoard :... | leocassarani/noughts-and-crosses | src/Lib.hs | Haskell | mit | 2,262 |
{-|
Module : TestUtils.Validate
Description : The Validate type class
Copyright : (c) Andrew Burnett 2014-2015
Maintainer : andyburnett88@gmail.com
Stability : experimental
Portability : Unknown
'Validate' provides a definition for validating a data structure. For example,
we may cache information about the ... | aburnett88/HSat | tests-src/TestUtils/Validate.hs | Haskell | mit | 712 |
module Language.Aspell (
-- * Constructors
SpellChecker,
spellChecker,
spellCheckerWithOptions,
spellCheckerWithDictionary,
-- * Using the spell checker
check,
suggest
) where
import Data.ByteString.Char8
import Foreign
#if !MIN_VERSION_base(4,7,0)
hiding (unsafePerformIO)
#endif
... | pikajude/haspell | Language/Aspell.hs | Haskell | mit | 9,412 |
{- |
module: Main
description: Testing the FEN to Unicode conversion
license: MIT
maintainer: Joe Leslie-Hurd <joe@gilith.com>
stability: provisional
portability: portable
-}
module Main
( main )
where
import qualified Unicode
import qualified Chess
tests :: [(String,String,Chess.Edge)]
tests =
[("Initial posi... | gilith/opentheory | data/haskell/fen2s/src/Test.hs | Haskell | mit | 765 |
{-# LANGUAGE TupleSections #-}
module Y2016.M09.D09.Solution where
import Control.Arrow (first)
import Control.Monad (guard, (>=>))
import Data.Function (on)
import Data.List (sortBy)
import Data.Map (Map)
import qualified Data.Map as Map
-- below import available from 1HaskellADay git repository
import Control.Lis... | geophf/1HaskellADay | exercises/HAD/Y2016/M09/D09/Solution.hs | Haskell | mit | 3,206 |
{-# htermination (scanl :: (a -> b -> a) -> a -> (List b) -> (List a)) #-}
import qualified Prelude
data MyBool = MyTrue | MyFalse
data List a = Cons a (List a) | Nil
scanl0 f q Nil = Nil;
scanl0 f q (Cons x xs) = scanl f (f q x) xs;
scanl :: (b -> a -> b) -> b -> (List a) -> (List b);
scanl f ... | ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/scanl_1.hs | Haskell | mit | 352 |
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE OverloadedStrings #-}
-- | The GhostLang.Node.Flow module is implementing the Flows -
-- business logic - for the Node.
module GhostLang.Node.Flow
( getHttpConfig
, setHttpConfig
, listPrograms
, listPatternsFromProgram
, runNamedPattern
, runRando... | kosmoskatten/ghost-lang | ghost-node/src/GhostLang/Node/Flow.hs | Haskell | mit | 8,813 |
{-# LANGUAGE CPP #-}
module GHCJS.DOM.DataTransfer (
#if (defined(ghcjs_HOST_OS) && defined(USE_JAVASCRIPTFFI)) || !defined(USE_WEBKIT)
module GHCJS.DOM.JSFFI.Generated.DataTransfer
#else
#endif
) where
#if (defined(ghcjs_HOST_OS) && defined(USE_JAVASCRIPTFFI)) || !defined(USE_WEBKIT)
import GHCJS.DOM.JSFFI.Generat... | plow-technologies/ghcjs-dom | src/GHCJS/DOM/DataTransfer.hs | Haskell | mit | 349 |
{-# LANGUAGE BangPatterns, DataKinds, DeriveDataTypeable, FlexibleInstances, MultiParamTypeClasses #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module Hadoop.Protos.YarnProtos.AMCommandProto (AMCommandProto(..)) where
import Prelude ((+), (/), (.))
import qualified Prelude as Prelude'
import qualified Data.Typeable... | alexbiehl/hoop | hadoop-protos/src/Hadoop/Protos/YarnProtos/AMCommandProto.hs | Haskell | mit | 2,466 |
-- module Day04 (solveDay04) where
module Day04 where
import Control.Monad (mapM_)
import Data.Char (chr, isDigit, ord)
import Data.Function (on)
import Data.List (group, nub, sort, sortBy)
import Data.List.Split (splitOn, wordsBy)
isSquareBracket :: C... | justanotherdot/advent-linguist | 2016/Haskell/AdventOfCode/src/Day04.hs | Haskell | mit | 1,928 |
{-# htermination minFM :: (Ord a, Ord k) => FiniteMap (Either a k) b -> Maybe (Either a k) #-}
import FiniteMap
| ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/full_haskell/FiniteMap_minFM_10.hs | Haskell | mit | 112 |
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeSynonymInstances #-}
module Stackage.BuildPlan
( readBuildPlan
, writeBuildPlan
) where
import qualified Data.Map as Map
import qualified Data.Set as Set
import Distribution.Text (display, sim... | yogsototh/stackage | Stackage/BuildPlan.hs | Haskell | mit | 5,250 |
module Puppet.Master.Interpreter ( InterpreterWorker
, newInterpreterWorker
, ask
, eval
, typeOf
) where
import Exception
import Control.Monad
import GH... | jd823592/puppeteer | src/Puppet/Master/Interpreter.hs | Haskell | mit | 1,473 |
{-# LANGUAGE Haskell2010
, MagicHash
, FlexibleInstances
, FlexibleContexts
, MultiParamTypeClasses
, FunctionalDependencies
#-}
{-# OPTIONS
-Wall
-fno-warn-missing-signatures
-fno-warn-name-shadowing
#-}
-- | This module contains mostly boiler plate code that is needed
-- for method ... | fehu/haskell-java-bridge-fork | src/Foreign/Java/Types.hs | Haskell | mit | 9,256 |
module Feature.DeleteSpec where
import Test.Hspec
import Test.Hspec.Wai
import Text.Heredoc
import SpecHelper
import PostgREST.Types (DbStructure(..))
import qualified Hasql.Connection as H
import Network.HTTP.Types
spec :: DbStructure -> H.Connection -> Spec
spec struct c = beforeAll resetDb
. around (withApp c... | motiz88/postgrest | test/Feature/DeleteSpec.hs | Haskell | mit | 1,312 |
module Data.HashId
(
-- * Core types
HashId
, HashEncoder
, HashOptions
, Salt
-- * Core functions
, defaultOptions
, mkEncoder
, encode
, decode
, parse
, toText
, salt
) where
import Data.HashId.Inte... | muhbaasu/hash-id | src/Data/HashId.hs | Haskell | mit | 325 |
{-# LANGUAGE QuasiQuotes, TemplateHaskell #-}
{-# OPTIONS_GHC -Wall #-}
-- http://www.well-typed.com/blog/2014/10/quasi-quoting-dsls/
import QQAst
import Language.Haskell.TH.Syntax
prog1 :: Prog
prog1 = [prog|
var x ;
x := read ;
write (x + x + 1)
|]
prog2 :: VarName -> Integer -> Prog
prog2 y n = [p... | egaburov/funstuff | Haskell/thsk/qqast.hs | Haskell | apache-2.0 | 707 |
-- Copyright 2015 Peter Harpending
--
-- 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 agre... | pharpend/editor-open | tests/test_yaml_file.hs | Haskell | apache-2.0 | 1,128 |
{-# LANGUAGE OverloadedStrings #-}
module Data.Attoparsec.Text.Machine where
import Data.Attoparsec.Machine (processParserWith, streamParserWith)
import Data.Attoparsec.Text (Parser, parse, takeWhile)
import Data.Machine (ProcessT, asParts, auto, (<~))
import Data.Text (Text)
asLines :: Monad m => ProcessT m Text Te... | aloiscochard/sarsi | src/Data/Attoparsec/Text/Machine.hs | Haskell | apache-2.0 | 756 |
-- |
-- Module : Test.QuickCheck.Util.Combinator
--
-- Copyright : (C) 2010-2012 Joachim Fasting
-- License : BSD-style (see COPYING)
-- Maintainer : Joachim Fasting <joachim.fasting@gmail.com>
--
-- Additional combinators for QuickCheck.
module Test.QuickCheck.Util.Combinator
( pairOf
, tripleOf
,... | joachifm/QuickCheck-util | Test/QuickCheck/Util/Combinator.hs | Haskell | bsd-2-clause | 872 |
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedLabels #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TupleSections #-}
module YX.Shell
( findShell
, shellExePaths
, ExecuteShellException(..)
, module YX.Type.Shell
-- * Uti... | trskop/yx | src/YX/Shell.hs | Haskell | bsd-3-clause | 2,371 |
{-# LANGUAGE FlexibleContexts #-}
module Opaleye.Manipulation (module Opaleye.Manipulation,
U.Unpackspec) where
import qualified Opaleye.Internal.Sql as Sql
import qualified Opaleye.Internal.Print as Print
import qualified Opaleye.RunQuery as RQ
import qualified Opaleye.Internal.RunQuery ... | danse/haskell-opaleye | src/Opaleye/Manipulation.hs | Haskell | bsd-3-clause | 8,377 |
{-# LANGUAGE TemplateHaskell #-}
module Horbits.UI.Camera.Internal where
import Control.Lens
import Data.Fixed
import Data.List.NonEmpty as NE
import Linear
import Horbits.UI.Camera.Zoom
-- data type
data OrthoCamera a = OrthoCamera { _orthoCameraCenter ... | chwthewke/horbits | src/horbits/Horbits/UI/Camera/Internal.hs | Haskell | bsd-3-clause | 4,533 |
module FP.Parser.SExp where
import FP.Prelude
import FP.Parser.Parser
import FP.Pretty
import qualified Prelude
data SNumber =
SNInteger ℤ
| SNDouble 𝔻
deriving (Eq,Ord)
makePrettySum ''SNumber
data SLit =
SLNumber SNumber
| SLString 𝕊
deriving (Eq,Ord)
makePrettySum ''SLit
data SToken =
STL... | davdar/darailude | src/FP/Parser/SExp.hs | Haskell | bsd-3-clause | 4,949 |
{-# LANGUAGE OverloadedStrings, RecursiveDo, ScopedTypeVariables, FlexibleContexts, TypeFamilies, ConstraintKinds #-}
module Frontend.Properties.R53
(
r53Properties
) where
import Prelude hiding (mapM, mapM_, all, sequence)
import qualified Data.Map as Map
import Data.Monoid ((<>)... | Rizary/awspi | Lib/Frontend/Properties/R53.hs | Haskell | bsd-3-clause | 4,264 |
{-# LANGUAGE FlexibleInstances #-}
module Eval (
runEval
) where
import Control.Monad.State
import Control.Monad.Writer (WriterT, runWriterT, tell)
import Data.List
import Data.Maybe
import qualified Data.Map as Map
import Text.PrettyPrint
import Pretty
import Syntax
-- Values
data Value
= VInt Integer
| VBo... | zanesterling/haskell-compiler | src/Eval.hs | Haskell | bsd-3-clause | 1,951 |
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module HTIG.IRCServer.Core
( IRCState(..)
, IRCM
, runIRCM
, runIRCM'
, getConn
, getGlobal
, setGlobal
, modifyGlobal
, modifyGlobal'
, getLocal
, setLocal
, modifyLocal
, modifyLocal'
, liftIO
) where
import C... | nakamuray/htig | HTIG/IRCServer/Core.hs | Haskell | bsd-3-clause | 2,338 |
{- |
Module : Skel
Description : Description
Copyright : 2014, Peter Harpending.
License : BSD3
Maintainer : Peter Harpending <pharpend2@gmail.com>
Stability : experimental
Portability : archlinux
-}
module Skel where
| pharpend/flogger | skel/Skel.hs | Haskell | bsd-3-clause | 240 |
{-
Copyright (c) 2014-2015, Johan Nordlander, Jonas Duregård, Michał Pałka,
Patrik Jansson and Josef Svenningsson
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistribu... | josefs/autosar | oldARSim/ARText.hs | Haskell | bsd-3-clause | 16,113 |
import Control.Monad
import Control.Concurrent
import Control.Concurrent.STM
import System.Posix.IO
import GHC.Event
main_ :: IO ()
main_ = do
Just em <- getSystemEventManager
registerTimeout em 1000000 (print 888)
registerFd em (\k e -> getLine >>= print >> print k >> print e) stdInput evtRead
threadDelay 2000000... | YoshikuniJujo/xmpipe | test/testPolling.hs | Haskell | bsd-3-clause | 643 |
{-# LANGUAGE TemplateHaskell, FlexibleContexts, FlexibleInstances, MultiParamTypeClasses, TypeFamilies #-}
module WormLikeChain where
import Control.Applicative
import Control.Monad
import qualified Data.Vector.Unboxed as V
import qualified Data.Vector.Generic
import qualified Data.Vector.Generic.Mutable
import Data... | bgamari/polymer-models | WormLikeChain.hs | Haskell | bsd-3-clause | 6,303 |
{-# LANGUAGE TypeFamilies ,MultiParamTypeClasses,DeriveFunctor,DeriveFoldable,DeriveGeneric ,TypeOperators#-}
module Scaling.S1 where
import Space.Class
import Exponential.Class
import Data.Foldable
import Multiplicative.Class
import Data.FMonoid.Class
import Data.Distributive
import Data.Monoid
import Linear.V2
impor... | massudaw/mtk | Scaling/S1.hs | Haskell | bsd-3-clause | 1,199 |
{-# LANGUAGE OverloadedStrings, ScopedTypeVariables #-}
module Text.HeX.Standard.LaTeX (defaults) where
import Text.HeX
import Text.HeX.Standard.TeX (ctl, ch, grp)
import Text.HeX.Standard.Generic (getSectionNum)
defaults :: HeX ()
defaults = do
addParser [Inline] $ basicInline ch
addParser [Block] $ basicBlock t... | jgm/HeX | Text/HeX/Standard/LaTeX.hs | Haskell | bsd-3-clause | 1,264 |
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Network.Linode.Internal where
import Control.Error
import Control.Exception (IOException, handle)
import Control.Lens ((&), (.~), (^?))
import Control.Monad.IO.Class (liftIO)
import ... | Helkafen/haskell-linode | src/Network/Linode/Internal.hs | Haskell | bsd-3-clause | 2,388 |
import Tutorial.Chapter8.Bug (Sex(..), BugColour(..), buildBug)
import ALife.Creatur.Universe (store, mkSimpleUniverse)
import ALife.Creatur.Genetics.BRGCBool (put, runWriter,
runDiploidReader)
import Control.Monad.State.Lazy (evalStateT)
main :: IO ()
main = do
let u = mkSimpleUniverse "Chapter8" "chapter8"
... | mhwombat/creatur-examples | src/Tutorial/Chapter8/GeneratePopulation.hs | Haskell | bsd-3-clause | 925 |
module Main where
import Control.Monad
import System.Exit (exitFailure)
import System.Environment
import L2.AbsL
import L2.ParL
import L2.ErrM
import Liveness.Liveness
main :: IO ()
main = do
args <- getArgs
when (length args /= 1) $ do
putStrLn "usage: filename"
exitFailure
ts <- liftM myL... | mhuesch/scheme_compiler | src/Liveness/Main.hs | Haskell | bsd-3-clause | 585 |
module Matterhorn.Events.ChannelListOverlay
( onEventChannelListOverlay
, channelListOverlayKeybindings
, channelListOverlayKeyHandlers
)
where
import Prelude ()
import Matterhorn.Prelude
import qualified Graphics.Vty as Vty
import Matterhorn.Events.Keybindings
import ... | matterhorn-chat/matterhorn | src/Matterhorn/Events/ChannelListOverlay.hs | Haskell | bsd-3-clause | 1,458 |
{-# LANGUAGE NoMonomorphismRestriction #-}
import Diagrams.Prelude
import Diagrams.Backend.Cairo.CmdLine
import System.Environment
main = withArgs [ "-o", "test4.png", "-w", "400", "-h", "400" ] $ defaultMain $ ((text "ABCDEFGHabcdefgh" # fontSize 2 # translateX 8 <> rect 10 1 # lw 0.1) # translateX (-5)) <> rect 12... | diagrams/diagrams-test | misc/av-font.hs | Haskell | bsd-3-clause | 332 |
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE RecordWildCards #-}
module LDrive.Platforms where
-- ( testPlatformParser
-- , ColoredLEDs(..)
--... | sorki/odrive | src/LDrive/Platforms.hs | Haskell | bsd-3-clause | 9,381 |
module Main
(
main
) where
import qualified Data.ByteString.Lazy.Char8 as L
import qualified Data.Attoparsec.Char8 as P
import Data.Attoparsec.Lazy hiding (skipWhile,take)
import Data.List (intercalate,transpose)
import NanoUtils.Container (normalizeByMax)
import System.IO
main = do
xss <- parseFile
... | nanonaren/Reducer | Normalize.hs | Haskell | bsd-3-clause | 706 |
{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances,
PatternGuards #-}
module Idris.Core.Evaluate(normalise, normaliseTrace, normaliseC, normaliseAll,
rt_simplify, simplify, specialise, hnf, convEq, convEq',
Def(..), CaseInfo(..), CaseDefs(..),
Accessibili... | ctford/Idris-Elba-dev | src/Idris/Core/Evaluate.hs | Haskell | bsd-3-clause | 40,466 |
{-| Implementation of the primitives of instance allocation
-}
{-
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 so... | mbakke/ganeti | src/Ganeti/HTools/Cluster/AllocatePrimitives.hs | Haskell | bsd-2-clause | 3,665 |
-- |
-- Module : Foundation.Tuple
-- License : BSD-style
-- Maintainer : Vincent Hanquez <vincent@snarc.org>
-- Stability : experimental
-- Portability : portable
--
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
module Foundation.Tuple
( Tuple2(..)
, Tuple3(..)
, Tuple4(..)
... | vincenthz/hs-foundation | foundation/Foundation/Tuple.hs | Haskell | bsd-3-clause | 3,381 |
{-# LANGUAGE TemplateHaskell #-}
module Version where
import Version.TH
import Data.Version (showVersion)
import qualified Paths_birch as P
version :: String
version = showVersion P.version ++ "-" ++ $(getCommitHash)
| hithroc/hsvkbot | src/Version.hs | Haskell | bsd-3-clause | 218 |
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE GADTs #-}
module Llvm.Pass.RewriteUse where
import Control.Monad
import Data.Maybe
import Prelude hiding (succ)
import qualified Compiler.Hoopl as H
import Llvm.Data.Ir
import Llvm.Util.Monadic (maybeM)
import Debug.Trace
type MaybeChange a = a -> Maybe a
f2 :: (a -... | mlite/hLLVM | src/Llvm/Pass/RewriteUse.hs | Haskell | bsd-3-clause | 10,153 |
--------------------------------------------------------------------
-- |
-- Module : Text.XML.Light.Cursor
-- Copyright : (c) Galois, Inc. 2008
-- License : BSD3
--
-- Maintainer: Iavor S. Diatchki <diatchki@galois.com>
-- Stability : provisional
-- Portability: portable
--
-- XML cursors for working XML content ... | amremam2004/vxmlizer | Text/XML/Light/Cursor.hs | Haskell | bsd-3-clause | 10,568 |
module Usage.Usage where
import qualified Definition.Definition as D.D
test :: Int
test = D.D.s<caret>even + 1
| charleso/intellij-haskforce | tests/gold/codeInsight/QualifiedImportMultipleLevels_AsPartConsistsOfMultipleCons/Usage/Usage.hs | Haskell | apache-2.0 | 115 |
{-# OPTIONS_GHC -fwarn-safe #-}
-- | Basic test to see if Safe warning flags compile
-- Warn if module is inferred safe
-- In this test the warning _shouldn't_ fire
module SafeFlags23 where
import System.IO.Unsafe
f :: Int
f = 1
| sdiehl/ghc | testsuite/tests/safeHaskell/flags/SafeFlags24.hs | Haskell | bsd-3-clause | 232 |
<?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="hr-HR">
<title>Directory List v2.3</title>
<maps>
<homeID>directorylistv2_3</homeID>
<m... | thc202/zap-extensions | addOns/directorylistv2_3/src/main/javahelp/help_hr_HR/helpset_hr_HR.hs | Haskell | apache-2.0 | 978 |
{-
Parser.hs: Parser for the Flounder interface definition language
Part of Flounder: a strawman device definition DSL for Barrelfish
Copyright (c) 2009, ETH Zurich.
All rights reserved.
This file is distributed under the terms in the attached LICENSE file.
If you do not ... | joe9/barrelfish | tools/flounder/Parser.hs | Haskell | mit | 9,137 |
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeOperators #-}
module T15361 where
import Data.Kind
import Data.Type.Equality
-- Don't report (* ~ *) here
foo :: forall (a :: Type) (b :: Type) (c :: Type).
a :~~: b -> a :~~: c
foo HRefl = HRefl
data Chumbawam... | sdiehl/ghc | testsuite/tests/typecheck/should_fail/T15361.hs | Haskell | bsd-3-clause | 495 |
import qualified Data.Vector as U
import Data.Bits
main = print . U.maximumBy (\x y -> GT) . U.map (*2) . U.map (`shiftL` 2) $ U.replicate (100000000 :: Int) (5::Int)
| hvr/vector | old-testsuite/microsuite/maximumBy.hs | Haskell | bsd-3-clause | 168 |
import Data.Bits ((.&.))
flags :: Int -> Int
flags x
| x .&. 128 > 0 = 12
| otherwise = 13
{-# NOINLINE flags #-}
main :: IO ()
main = print (flags 255)
| ezyang/ghc | testsuite/tests/codeGen/should_run/T13425.hs | Haskell | bsd-3-clause | 159 |
-- !!! Check the Read instance for Array
-- [Not strictly a 'deriving' issue]
module Main( main ) where
import Data.Array
bds :: ((Int,Int),(Int,Int))
bds = ((1,4),(2,5))
type MyArr = Array (Int,Int) Int
a :: MyArr
a = array bds [ ((i,j), i+j) | (i,j) <- range bds ]
main = do { putStrLn (show a) ;
let ... | olsner/ghc | testsuite/tests/deriving/should_run/drvrun009.hs | Haskell | bsd-3-clause | 418 |
-- !!! Test seeking
import System.IO
main = do
h <- openFile "hSeek001.in" ReadMode
True <- hIsSeekable h
hSeek h SeekFromEnd (-1)
z <- hGetChar h
putStr (z:"\n")
hSeek h SeekFromEnd (-3)
x <- hGetChar h
putStr (x:"\n")
hSeek h RelativeSeek (-2)
w <- hGetChar h
putStr (w:"... | urbanslug/ghc | libraries/base/tests/IO/hSeek001.hs | Haskell | bsd-3-clause | 614 |
{-# LANGUAGE JavaScriptFFI #-}
module Doppler.GHCJS.VirtualDOM.VDom (
VDom, requireVDom
) where
import GHCJS.Types (JSVal)
newtype VDom = VDom JSVal
foreign import javascript interruptible "require(['virtual-dom'], $c);"
requireVDom :: IO VDom
| oinuar/doppler | src/Doppler/GHCJS/VirtualDOM/VDom.hs | Haskell | mit | 254 |
import Data.List
import Data.Text hiding (intercalate, map)
import System.Hclip
import Text.ParserCombinators.Parsec
-- | Strip, with Strings instead of Text for arguments
trim :: String -> String
trim = unpack . strip . pack
-- | A single cell of a matrix
b... | mystor/matrix-detex | MatrixDetex.hs | Haskell | mit | 1,604 |
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE CPP #-}
module Test.Hspec.Wai.Internal (
WaiExpectation
, WaiSession(..)
, runWaiSession
, runWithState
, withApplication
, getApp
, getState
, formatHeader
) wh... | hspec/hspec-wai | src/Test/Hspec/Wai/Internal.hs | Haskell | mit | 1,937 |
{-# LANGUAGE PatternSynonyms #-}
-- For HasCallStack compatibility
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module JSDOM.Generated.SQLTransactionErrorCallback
(newSQLTransactionErrorCallback,
newSQLTransactionErrorCallbackSync,
... | ghcjs/jsaddle-dom | src/JSDOM/Generated/SQLTransactionErrorCallback.hs | Haskell | mit | 2,755 |
module Instructions where
import Text.ParserCombinators.Parsec
import Control.Applicative hiding (many, (<|>))
type Coordinate = (Integer, Integer)
type Region = (Coordinate, Coordinate)
data Instruction = Instruction Task Region
deriving (Show)
data Task = TurnOn | Toggle | TurnOff
de... | corajr/adventofcode2015 | 6/Instructions.hs | Haskell | mit | 947 |
module Main where
import Lib
import Text.Printf
import Data.Time.Clock.POSIX
n = 4::Int
main :: IO ()
main = do
startTime <- getPOSIXTime
printf "Maximum product of %d values taken in a straight line from array 'values':\n\t%d"
n $ maxStraightProduct n
stopTime <- getPOSIXTime
printf "\t(%s sec)\n" $... | JohnL4/ProjectEuler | Haskell/Problem011/app/Main.hs | Haskell | mit | 349 |
-- | This module describes the interface (as a data tyep) that some variant
-- should implement. See `Variant`.
--
{-# LANGUAGE OverloadedStrings #-}
module NetHack.Data.Variant
( Variant()
, monster
, allMonsterNames
, commandPrefix
, variant
, loadVariant )
where
import Control.Applicat... | UnNetHack/pinobot | lib/NetHack/Data/Variant.hs | Haskell | mit | 1,915 |
module Euler.E9 where
euler9 :: Int -> Int
euler9 n = x*y*z
where
(x,y,z) = findTriple n
genTriples :: Int -> [(Int, Int, Int)]
genTriples n = [(x,y,z) | x <- [1..n], y <- [x..n], z <- [y..n], x+y+z == n]
isPythTriple :: (Int,Int,Int) -> Bool
isPythTriple (x,y,z) = or
[ x*x + y*y == z*z
, x*x + z*z == y*y
, y*y... | D4r1/project-euler | Euler/E9.hs | Haskell | mit | 472 |
module SyntheticWeb.Client.Executor
( executeTask
) where
import Control.Concurrent (threadDelay)
import Control.Concurrent.STM (atomically)
import Data.Time (NominalDiffTime)
import SyntheticWeb.Client.Http (get, post, put)
import SyntheticWeb.Client.TimedAction (timedAction)
import SyntheticWeb.Counter ( Byt... | kosmoskatten/synthetic-web | src/SyntheticWeb/Client/Executor.hs | Haskell | mit | 3,191 |
module AI where
import Control.Monad
import Data.Array.MArray
import Data.Array.IO
import Data.Word
import System.Random
type Index = Int
type Value = Int
type Weight = Value
type Neurons = IOArray Index Value
type Synapses = [(Index, Index, Weight)] -- src, dst, weight
type Goals = [Index]
type Brain ... | nitrix/ai | src/AI.hs | Haskell | mit | 1,853 |
import Data.List
isTriangular threeNumbers = x + y > z
where
[x, y, z] = sort threeNumbers
countTrue = length . filter id
parseInputLine = map (read :: String -> Integer) . words
main = do
input <- getContents
print . countTrue . map (isTriangular . parseInputLine) . lines $ input
| lzlarryli/advent_of_code_2016 | day3/part1.hs | Haskell | mit | 297 |
module Y2017.M03.D16.Solution where
import Data.Maybe (fromMaybe)
import Data.Set (Set)
import qualified Data.Set as Set
-- below imports available from 1HaskellADay git respository
import Analytics.Theory.Number.Prime
import Y2017.M03.D15.Solution (uniqueValuesUpTo)
{--
So, yesterday, when we solved the Exercise ... | geophf/1HaskellADay | exercises/HAD/Y2017/M03/D16/Solution.hs | Haskell | mit | 2,693 |
{-# LANGUAGE Haskell2010 #-}
module Deprecated where
-- | Docs for something deprecated
deprecated :: Int
deprecated = 1
{-# DEPRECATED deprecated "Don't use this" #-}
| haskell/haddock | latex-test/src/Deprecated/Deprecated.hs | Haskell | bsd-2-clause | 170 |
-- http://www.codewars.com/kata/54d6abf84a35017d30000b26
module Data.Complex.Gaussian.Prime where
import Data.Complex.Gaussian (Gaussian (..), norm)
isGaussianPrime :: Gaussian -> Bool
isGaussianPrime z@(Gaussian x y)
= n==2
|| n`mod`4==1 && isPrime n
|| y==0 && abs x `mod` 4==3 && isPrime (abs x)
|| x==0 &&... | Bodigrim/katas | src/haskell/B-Gaussian-primes.hs | Haskell | bsd-2-clause | 516 |
{-# LANGUAGE Haskell2010 #-}
module Operators where
(+++) :: [a] -> [a] -> [a]
a +++ b = a ++ b ++ a
($$$) :: [a] -> [a] -> [a]
a $$$ b = b +++ a
(***) :: [a] -> [a] -> [a]
(***) a [] = a
(***) a (_:b) = a +++ (a *** b)
(*/\*) :: [[a]] -> [a] -> [a]
a */\* b = concatMap (*** b) a
(**/\**) :: [[a]] -> [[a]] -> [[a... | haskell/haddock | hypsrc-test/src/Operators.hs | Haskell | bsd-2-clause | 431 |
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE Rank2Types #-}
{-# LAN... | Hodapp87/ivory | ivory/src/Ivory/Language/Proc.hs | Haskell | bsd-3-clause | 11,895 |
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE LambdaCase #-}
module Development.Cake3.Ext.UrWeb whe... | grwlf/cake3 | src/Development/Cake3/Ext/UrWeb1.hs | Haskell | bsd-3-clause | 24,818 |
{-# LANGUAGE CPP #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TupleSections ... | mietek/stack | src/Stack/Build.hs | Haskell | bsd-3-clause | 12,655 |
{-# OPTIONS -Wall #-}
-- The pec embedded compiler
-- Copyright 2011-2012, Brett Letner
module Pec.LLVM (dModule) where
import Control.Concurrent
import Data.Char
import Data.Generics.Uniplate.Data
import Data.List
import Data.Maybe
import Development.Shake.FilePath
import Grm.Prims
import Language.LLVM.Abs
import N... | stevezhee/pec | Pec/LLVM.hs | Haskell | bsd-3-clause | 12,321 |
{-# LANGUAGE PatternSynonyms #-}
--------------------------------------------------------------------------------
-- |
-- Module : Graphics.GL.EXT.PackedPixels
-- Copyright : (c) Sven Panne 2019
-- License : BSD3
--
-- Maintainer : Sven Panne <svenpanne@gmail.com>
-- Stability : stable
-- Portability... | haskell-opengl/OpenGLRaw | src/Graphics/GL/EXT/PackedPixels.hs | Haskell | bsd-3-clause | 816 |
{-# LANGUAGE CPP #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE MultiParamTypeClasses #-}
#if __GLASGOW_HASKELL__ >= 702 && __GLASGOW_HASKELL__ < 710
{-# LANGUAGE Trustworthy #-}
#endif
-----------------------------------------------------------------------------
-- |
-- Module : Control.Comonad.Density
-- Copyright :... | xuwei-k/kan-extensions | src/Control/Comonad/Density.hs | Haskell | bsd-3-clause | 3,776 |
{-# LANGUAGE TemplateHaskell #-}
------------------------------------------------------------------------------
-- | This module defines our application's state type and an alias for its
-- handler monad.
--
module Application where
------------------------------------------------------------------------------
impo... | HaskellCNOrg/snap-web | src/Application.hs | Haskell | bsd-3-clause | 1,347 |
{-
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998
\section[RnExpr]{Renaming of expressions}
Basically dependency analysis.
Handles @Match@, @GRHSs@, @HsExpr@, and @Qualifier@ datatypes. In
general, all of these functions return a renamed thing, and a set of
free variables.
-}
{-# LANGUAGE CPP #-}
{-# LA... | mcschroeder/ghc | compiler/rename/RnExpr.hs | Haskell | bsd-3-clause | 78,620 |
{-# LANGUAGE CPP #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoStrict #-}
{-# LANGUAGE TupleSections #-}
module Data.IP.Builder
( -- * 'P.BoundedPrim' 'B.Builder's for general, IPv4 and IPv6 addresses.
ipBuilder
, ipv4B... | kazu-yamamoto/iproute | Data/IP/Builder.hs | Haskell | bsd-3-clause | 10,407 |
{-# LANGUAGE ScopedTypeVariables #-}
-- | This module is unstable; functions are not guaranteed to be the same or even to exist in future versions
--
-- It is intended primarily for use by this library itself.
module Data.Bitmap.Util
( tablespoon
, subStr
, padByte
) where
import Control.Exception
imp... | bairyn/bitmaps | src/Data/Bitmap/Util.hs | Haskell | bsd-3-clause | 1,643 |
{-# LANGUAGE OverloadedStrings #-}
module Views.Common.SEO where
import Control.Monad
import qualified Data.Text as T
import Data.Text.Lazy(Text)
import Data.String (fromString)
import qualified Text.Printf as PF
import Network.URI
import Text.Blaze.Html5((!))
import qualified Text.Blaze.Html5 as H
import qualified ... | DavidAlphaFox/sblog | src/Views/Common/SEO.hs | Haskell | bsd-3-clause | 1,437 |
{-# LANGUAGE Safe, TypeFamilies #-}
module Data.Logic.Atom (
Atom, atom, unit
) where
import Control.Monad.Predicate
import Data.Logic.Term
import Data.Logic.Var
-- |A constant term.
newtype Atom a s = Atom a
instance Eq a => Term (Atom a) where
type Collapse (Atom a) = a
collapse (Atom x) = return x
... | YellPika/tlogic | src/Data/Logic/Atom.hs | Haskell | bsd-3-clause | 539 |
{-|
Module : AERN2.Utils.Bench
Description : utilities for benchmarks
Copyright : (c) Michal Konecny
License : BSD3
Maintainer : mikkonecny@gmail.com
Stability : experimental
Portability : portable
-}
module AERN2.Utils.Bench
(
listFromGen
)
where
-- import Test.Qu... | michalkonecny/aern2 | aern2-mp/src/AERN2/Utils/Bench.hs | Haskell | bsd-3-clause | 718 |
-- | The type of cave kinds. Every level in the game is an instantiated
-- cave kind.
module Game.LambdaHack.Content.CaveKind
( pattern DEFAULT_RANDOM
, CaveKind(..), InitSleep(..), makeData
#ifdef EXPOSE_INTERNAL
-- * Internal operations
, validateSingle, validateAll, mandatoryGroups
#endif
) where
import... | LambdaHack/LambdaHack | definition-src/Game/LambdaHack/Content/CaveKind.hs | Haskell | bsd-3-clause | 7,660 |
-- |
-- Module : Data.Semiring.Properties
-- Copyright : Sebastian Fischer <mailto:mail@sebfisch.de>
-- License : BSD3
--
-- This library provides properties for the 'Semiring' type class that
-- can be checked using libraries like QuickCheck or SmallCheck.
--
module Data.Semiring.Properties (
module D... | sebfisch/haskell-regexp | src/Data/Semiring/Properties.hs | Haskell | bsd-3-clause | 1,632 |
module Test.Cache(main) where
import Development.Shake
import Development.Shake.FilePath
import System.Directory
import Data.Char
import Test.Type
main = testBuild test $ do
vowels <- newCache $ \file -> do
src <- readFile' file
liftIO $ appendFile "trace.txt" "1"
pure $ length $ filter ... | ndmitchell/shake | src/Test/Cache.hs | Haskell | bsd-3-clause | 2,096 |
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
-- |
-- Module: $HEADER$
-- Description: TODO
-... | FPBrno/dht-dks | src/Data/DHT/DKS/Type/Message/UpdateSuccessorAck.hs | Haskell | bsd-3-clause | 1,039 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.