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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
module Network.Linx.Gateway.BinaryList
( putList
, getList
) where
import Control.Monad (replicateM)
import Data.Binary hiding (putList)
import Network.Linx.Gateway.Types
putList :: Binary a => [a] -> Put
putList = mapM_ put
getList :: Binary a => Length -> Get [a]
getList len = replicateM (asIn... | kosmoskatten/linx-gateway | src/Network/Linx/Gateway/BinaryList.hs | mit | 331 | 0 | 8 | 69 | 112 | 63 | 49 | 10 | 1 |
{-# LANGUAGE TemplateHaskell #-}
module Server where
--------------------
-- Global Imports --
import Prelude hiding (error)
import Network.HTTP.Types.Status
import Control.Monad.IO.Class
import Data.Aeson.Types
import Data.Aeson.TH
import Data.IORef
import Web.Scotty
import Data.Char
-------------------
-- Local Im... | crockeo/tic-taskell | src/Server.hs | mit | 4,152 | 0 | 17 | 1,473 | 846 | 449 | 397 | 85 | 2 |
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE CPP #-}
module Data.Comparaptor.Ord.Tests (tests) where
#define TEST(TYPE) testProperty "safeCompare TYPE" (testOrd :: TYPE -> TYPE -> Bool)
import qualified Data.ByteString as StrictByteString
import Test.Framework (Test, testGroup)
import Test.Framework.Providers... | lambda-llama/comparaptor | tests/Data/Comparaptor/Ord/Tests.hs | mit | 820 | 0 | 8 | 126 | 196 | 118 | 78 | 18 | 1 |
module Game.Process.Renderer where
import Data.Maybe
import Game.Types
import Game.Output.Shapes
import Game.Util
class GameRenderer a where
render :: ResolutionSettings -> (Double, a) -> RenderObject
instance GameRenderer GameObject where
render (_, renderScale) (time, gameObject) = shape
where
... | flomerz/SchaffschNie | src/Game/Process/Renderer.hs | mit | 3,359 | 0 | 16 | 1,135 | 962 | 504 | 458 | 43 | 1 |
module Main where
import Shared (primes)
main :: IO ()
main = print $ sum $ takeWhile (< 2000000) primes
| jBugman/euler | part1/p010.hs | mit | 107 | 0 | 7 | 22 | 44 | 25 | 19 | 4 | 1 |
module Formatter (count) where
import Data.IORef
import Control.Monad.IO.Class
import Test.Hspec.Formatters
count :: IO Formatter
count = do
ref <- newIORef (0 :: Int)
return silent {
exampleSucceeded = \_ -> liftIO (modifyIORef ref succ)
, footerFormatter = liftIO (readIOR... | beni55/hspec | hspec-discover/integration-test/with-io-formatter/Formatter.hs | mit | 355 | 0 | 14 | 95 | 109 | 60 | 49 | 10 | 1 |
{-# LANGUAGE NoMonomorphismRestriction
#-}
module Plugins.Gallery.Gallery.Manual38 where
import Diagrams.Prelude
dot = circle 1 # fc black
mkRow n = hcat' with {sep = 0.5} (replicate n dot)
mkTri n = decoratePath
(fromOffsets (replicate (n-1) (2.5 *^ unitX))
# rotateBy (1/6))
... | andrey013/pluginstest | Plugins/Gallery/Gallery/Manual38.hs | mit | 372 | 0 | 12 | 101 | 142 | 76 | 66 | 10 | 1 |
{-# LANGUAGE FlexibleContexts #-}
module Parser (Stack, Token(..), burlesque) where
import Control.Applicative hiding ((<|>), many)
import Data.List (intersperse)
import Data.Monoid (mconcat)
import Text.Parsec
import Text.Printf (printf)
data Token = BInt Int
| BFloat Double
| BString [Char]
... | hgiddens/virtue | src/Parser.hs | mit | 2,981 | 0 | 11 | 863 | 1,254 | 650 | 604 | 83 | 2 |
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
module Poi.Migrations.Migrate where
import Control.Exception (finally, try, bracket)
import Control.Monad (forM_, join, filterM, void)
import Data.ByteString.Char8 (unpack)
import Data.Char
import Data.List (intercala... | pranaysashank/poi | poi-bin/src/Poi/Migrations/Migrate.hs | mit | 10,525 | 0 | 20 | 2,513 | 2,712 | 1,369 | 1,343 | 195 | 8 |
{-# LANGUAGE RankNTypes #-}
module Jank.Interpret where
import Jank.Types
import Data.Aeson.Types hiding (parse, Parser)
import Data.Aeson.Lens
import Control.Lens hiding (argument, Empty, op)
import qualified Data.Vector as Vector
-- This could be refactored to use fold(l) if PrimOp was Foldable
path :: AsValue t =>... | 5outh/jank | src/Jank/Interpret.hs | mit | 848 | 0 | 9 | 162 | 325 | 170 | 155 | 22 | 1 |
module Splitter where
myWords :: String -> [String]
myWords "" = []
myWords xs =
let
notEmpty = (/=) ' '
word = takeWhile notEmpty xs
rest = dropWhile notEmpty xs
next = if rest == [] then [] else tail rest
in
word : myWords next
str = "hello world hello"
firstSen = "Tyger Tyger, burning bri... | andrewMacmurray/haskell-book-solutions | src/ch9/Splitter.hs | mit | 1,017 | 0 | 12 | 274 | 338 | 178 | 160 | 37 | 2 |
module Text.Greek.IO.Utility where
import qualified Control.Lens as Lens
import qualified Control.Monad.Except as Monad
import qualified Text.Greek.Utility as Utility
handleIOError :: Show a => IO (Either a b) -> Monad.ExceptT String IO b
handleIOError x = Monad.liftIO x >>= handleError
handleMaybe :: String -> Mayb... | scott-fleischman/greek-grammar | haskell/greek-grammar/src/Text/Greek/IO/Utility.hs | mit | 649 | 0 | 9 | 107 | 240 | 124 | 116 | 13 | 1 |
{-|
Module: Sally.Config
Description: Application configuration type and parser
Maintainer: lawrence.dunn.iii@gmail.com
License: MIT
-}
module Sally.Config (
Options.Applicative.execParser
, module Sally.Config
) where
import Control.Applicative ((<**>))
import Data.Monoid ((<>))
import Options.... | dunnl/sally | src/Sally/Config.hs | mit | 2,123 | 0 | 14 | 663 | 444 | 234 | 210 | 60 | 1 |
{-# LANGUAGE OverloadedStrings #-}
module InTheKnow.Routes.Home (routes) where
import qualified InTheKnow.Routes.Home.Templates as Template
import InTheKnow.Types
import Web.Scotty.Blaze (blaze)
import Web.Scotty
index :: ItkM ()
index = do
r <- renderer
liftScotty $ get "/" (r "Home" Template.index)
routes = i... | jb55/intheknow | InTheKnow/Routes/Home.hs | mit | 325 | 0 | 11 | 48 | 93 | 54 | 39 | 11 | 1 |
-- Copyright (c) 2004, 2008 Don Stewart - http://www.cse.unsw.edu.au/~dons
-- | Vi keymap for Yi.
-- Based on version 1.79 (7\/14\/97) of nex\/nvi
--
-- The goal is strict vi emulation
module Yi.Keymap.Vi ( keymap, ViMode ) where
import Yi.Yi
import Yi.Editor
-- import Yi.UI as UI
import Yi.History
import Control.A... | codemac/yi-editor | src/Yi/Keymap/Vi.hs | gpl-2.0 | 18,566 | 7 | 20 | 6,189 | 4,564 | 2,415 | 2,149 | 300 | 24 |
{-# LANGUAGE CPP #-}
{- |
Module : ./atermlib/src/ATerm/SimpPretty.hs
Description : simple pretty printing combinators
Copyright : (c) Klaus Luettich, C. Maeder Uni Bremen 2002-2005
License : GPLv2 or higher, see LICENSE.txt
Maintainer : Christian.Maeder@dfki.de
Stability : provisional
Portability ... | spechub/Hets | atermlib/src/ATerm/SimpPretty.hs | gpl-2.0 | 2,642 | 0 | 9 | 605 | 479 | 268 | 211 | 43 | 2 |
{-#LANGUAGE DeriveDataTypeable#-}
{-# LANGUAGE BangPatterns #-}
module SSHClient where
import Control.Concurrent.HEP as H
import Control.Concurrent
import Foreign.Marshal.Alloc
import Foreign.Ptr
import Foreign.C.Types
import System.IO as Sys
import Data.ByteString.Char8 as C
import Data.Typeable
import System.Proces... | dambaev/hproxy | src/SSHClient.hs | gpl-2.0 | 8,300 | 0 | 22 | 2,783 | 2,092 | 1,027 | 1,065 | 223 | 8 |
evalZ :: Expr -> Integer
evalZ RZero = 0
evalZ ROne = 1
evalZ (RAdd e1 e2) = evalZ e1 + evalZ e2
evalZ (RMul e1 e2) = evalZ e1 * evalZ e2
evalZ (RNeg e) = -(evalZ e) | hmemcpy/milewski-ctfp-pdf | src/content/3.8/code/haskell/snippet06.hs | gpl-3.0 | 184 | 0 | 7 | 57 | 100 | 48 | 52 | 6 | 1 |
{-# LANGUAGE OverloadedStrings #-}
-------------------------------------------------------------------------------
-- |
-- Module : OpenSandbox.World
-- Copyright : (c) 2016 Michael Carpenter
-- License : GPL3
-- Maintainer : Michael Carpenter <oldmanmike.dev@gmail.com>
-- Stability : experimental
--... | oldmanmike/opensandbox | src/OpenSandbox/World.hs | gpl-3.0 | 1,842 | 0 | 15 | 315 | 396 | 218 | 178 | -1 | -1 |
{-# LANGUAGE OverloadedStrings #-}
module Css.Common
(common) where
import Clay
import Prelude hiding ((**))
import Data.Monoid
import Css.Constants
{- common
- Generates CSS common to all pages. -}
common :: Css
common = do
html ?
do margin0
padding0
width100
height... | bell-kelly/courseography | app/Css/Common.hs | gpl-3.0 | 5,121 | 0 | 19 | 2,052 | 1,509 | 653 | 856 | 167 | 1 |
module Lambdacula (
module Lambdacula.Action,
module Lambdacula.GameData,
module Lambdacula.World,
module Lambdacula.Parser,
module Lambdacula.Display
) where
import Lambdacula.Action as Action
import Lambdacula.GameData as Gamedata
import Lambdacula.World as World
import Lambdacula.Parser as Parse... | Raveline/lambdacula | src/Lambdacula.hs | gpl-3.0 | 359 | 0 | 5 | 56 | 71 | 49 | 22 | 11 | 0 |
{-
Bool is a set with 2 values T, F
possible functions
T -> F - not
F -> T - not
T -> T - id
F -> F - id
* -> T - true
* -> F - false
-}
-- not == complement
complement :: Bool -> Bool
complement True = False
complement False = True
-- id == constant
constant :: Bool -> Bool
constant x = x
true :: Bool -... | sujeet4github/MyLangUtils | CategoryTheory_BartoszMilewsky/PI_02_Types_and_Functions/Bool.hs | gpl-3.0 | 1,079 | 0 | 10 | 271 | 316 | 152 | 164 | 27 | 1 |
-- | Types used to define the job queue.
module JobsDaemon.Type (
JobId, Job (..), JobType (..) {- from Model -}
, JobsQueue (..) , JobsChan (..), JobsDepends (..)
) where
import Prelude
import Control.Concurrent (MVar, Chan)
import qualified Data.Map as M
import Model (JobId, Job (..), JobType (..))
... | RaphaelJ/getwebb.org | JobsDaemon/Type.hs | gpl-3.0 | 1,222 | 0 | 11 | 252 | 194 | 128 | 66 | 10 | 0 |
{-# LANGUAGE FlexibleContexts #-}
import System.IO (hSetBuffering, stdin, stdout, BufferMode(..))
import Control.Monad.State
parseInput :: String -> Int
parseInput = read
insertScore :: (MonadState Int m) => Int -> m ()
insertScore input = modify (+ input)
calcScore :: (MonadState Int m) => m Int
calcScore = get
sc... | muralikrishna8/Haskell-problems | simpleREPLstate.hs | gpl-3.0 | 868 | 0 | 14 | 203 | 272 | 137 | 135 | 24 | 2 |
import Data.List
combinations i x = nub [take i y | y <- permutations x]
| nstarke/icc13-introduction-to-haskell | ex26.hs | lgpl-3.0 | 73 | 0 | 9 | 15 | 38 | 18 | 20 | 2 | 1 |
{-# LANGUAGE OverloadedStrings #-}
module Network.Haskoin.Crypto.Mnemonic.Tests (tests) where
import Data.Bits (shiftR, (.&.))
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as C
import Data.Either ... | plaprade/haskoin | haskoin-core/test/Network/Haskoin/Crypto/Mnemonic/Tests.hs | unlicense | 8,018 | 0 | 13 | 2,620 | 2,360 | 1,279 | 1,081 | -1 | -1 |
{-
stack
--resolver lts-8.0
--install-ghc
exec
--package base
--package quickspec
--package QuickCheck
--package testing-feat
--
ghc -O2
-}
-- Copyright 2017 Google Inc. All Rights Reserved.
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in... | polux/snippets | QuickSpecExample.hs | apache-2.0 | 2,813 | 0 | 11 | 645 | 839 | 443 | 396 | 61 | 4 |
-- | For functions which should have been System.Directory
module System.Directory.Extra where
import Data.List
import System.FilePath
-- | Only works with absolute paths.
--
-- >>> ancestors "/bin"
-- ["/","/bin"]
--
-- >>> ancestors "/bin/foo/bar"
-- ["/","/bin","/bin/foo","/bin/foo/bar"]
ancestors :: FilePath -... | gelisam/hawk | src/System/Directory/Extra.hs | apache-2.0 | 605 | 0 | 9 | 106 | 109 | 62 | 47 | 10 | 1 |
module Parse (parseArrow) where
import Types
import Control.Monad.Error (throwError)
import Text.ParserCombinators.Parsec
import qualified Data.Vector as V
validSym = oneOf "!#$%&|*+-/:<=>?@^_~"
parseInteger :: Parser Expr
parseInteger = do sign <- option "" (string "-")
number <- many1 digit
return $ Intege... | dbyrne/arrow | Parse.hs | apache-2.0 | 1,493 | 16 | 12 | 453 | 501 | 246 | 255 | 45 | 2 |
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
import Control.Monad.Error
import Control.Monad.State
import qualified Data.ByteString.Char8 as B
data ParseError = NumericOverflow
| EndOfInput
| Chatty String
deriving (Eq, Ord, Show)
instance Error Pa... | prt2121/haskell-practice | transformer/src/ParseInt.hs | apache-2.0 | 542 | 0 | 10 | 180 | 116 | 68 | 48 | 14 | 0 |
{-# LANGUAGE Haskell2010 #-}
module A where
data A = A
other :: Int
other = 2
-- | Doc for test2
test2 :: Bool
test2 = False
-- | Should show up on the page for both modules A and B
data X = X -- ^ Doc for consructor
-- | Should show up on the page for both modules A and B
reExport :: Int
reExport = 1
| haskell/haddock | html-test/src/A.hs | bsd-2-clause | 308 | 0 | 5 | 76 | 53 | 34 | 19 | 10 | 1 |
doubleMe x = x + x
doubleUs x y = doubleMe x + doubleMe y
doubleSmallNumber x = if x > 100
then x
else doubleMe x
timCooke = "Tim Cooke"
| trcooke/fun-with-haskell | baby.hs | bsd-2-clause | 144 | 4 | 6 | 38 | 65 | 32 | 33 | 6 | 2 |
{-# LANGUAGE FlexibleContexts, FlexibleInstances, RankNTypes, KindSignatures, UndecidableInstances #-}
module Main (main, arithmetic, comparisons, boolean, conditionals) where
import System.Environment (getArgs)
import Data.Functor.Compose (Compose(..))
import Data.Map (Map)
import qualified Rank2
import Text.Grampa (... | blamario/grampa | grammatical-parsers/examples/Main.hs | bsd-2-clause | 3,632 | 0 | 16 | 613 | 977 | 511 | 466 | 51 | 1 |
{-# LANGUAGE Haskell2010 #-}
{-# LANGUAGE PatternSynonyms, TypeOperators, TypeFamilies, MultiParamTypeClasses, GADTs #-}
{-# LANGUAGE FunctionalDependencies #-}
-- | Test operators with or without fixity declarations
module Operators where
-- | Operator with no fixity
(+-) :: a -> a -> a
a +- _ = a
-- | Operator wit... | haskell/haddock | html-test/src/Operators.hs | bsd-2-clause | 1,403 | 0 | 9 | 335 | 370 | 238 | 132 | 41 | 1 |
{-# LANGUAGE TypeSynonymInstances, FlexibleInstances #-}
module Lib
( expandExpr
, allExprs
, filterExprs
, Eval(..)
, Digit, Number, Term, Expr,
) where
import Control.Monad (join)
import Data.List (intercalate)
{-
Lazily build the list of all expressions,
starting with an empty expression. T... | smunix/digit-operations | src/Lib.hs | bsd-3-clause | 2,555 | 0 | 15 | 584 | 533 | 303 | 230 | 38 | 3 |
module Matasano.SetOne.ChallengeSix (test) where
import Data.Bits ((.&.), (.|.), popCount, shift, xor)
import Data.Char (chr)
import Data.Function (on)
import Data.List (maximumBy, minimumBy, tails, transpose)
import Data.Map (Map, findWithDefault, fromListWith)
import Data.Word (Word8)
import Matasano.Util (read64)
... | bisserlis/Matasano | src/Matasano/SetOne/ChallengeSix.hs | bsd-3-clause | 2,389 | 0 | 13 | 786 | 920 | 485 | 435 | -1 | -1 |
{-# LANGUAGE OverloadedStrings #-}
-- | Main entry point to renoise.
--
-- A Haskell API for Renoise.
module Main where
import Renoise
import Sound.OSC
-- | Main entry point.
main :: IO ()
main =
withTransport
(openTCP ip 8000)
(sendBundle (bundle immediately
[eval code]))
where ... | chrisdone/renoise | src/Main.hs | bsd-3-clause | 1,974 | 0 | 11 | 451 | 77 | 44 | 33 | 13 | 1 |
module Data.Char.Properties.PrivateData where
{
import Prelude;
handleOmittedRange :: a -> (Char -> a) -> Char -> a;
handleOmittedRange def _ c | (c < '\x3400') = def; -- optimisiation, catch about 99.9% of cases for non-CJK text
handleOmittedRange _ f c | (c > '\x3400') && (c <= '... | seereason/unicode-properties | Data/Char/Properties/PrivateData.hs | bsd-3-clause | 1,147 | 0 | 10 | 313 | 479 | 246 | 233 | 15 | 1 |
module Language.BCoPL.DataLevel.Diagram (
-- * Types
Diagram (..)
-- * Pretty Printer
, ppr
, textDiag
-- * Renderer for a diagram
, renderDiagram
) where
import Data.Tree (Tree(..))
import Text.PrettyPrint.Boxes (Box,(//),hsep,bottom,cols,text,moveRight,render)
data Diagram = Diagram {leading,judge... | nobsun/hs-bcopl | src/Language/BCoPL/DataLevel/Diagram.hs | bsd-3-clause | 1,873 | 0 | 16 | 525 | 678 | 384 | 294 | -1 | -1 |
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DeriveDataTypeable #-}
module Aws.Sign4.Test
( main
, tests
, testAll
) where
import Aws.Sign4
import Aws.Core
import ... | cdornan/aws-sign4 | Aws/Sign4/Test.hs | bsd-3-clause | 16,969 | 0 | 16 | 5,760 | 3,709 | 1,962 | 1,747 | 356 | 8 |
module Main where
import System.IO
import Control.Applicative
import Control.Monad
import Data.Tuple
import Data.Maybe
import qualified Data.List as L
import Data.Ord
import Control.Arrow
import Debug.Trace
import qualified Data.IntMap as M
import Data.IntMap ((!))
import qualified Data.IntSet as S
type V = Int
typ... | wuerges/solutions_for_graph_problems | app/Prob1080.hs | bsd-3-clause | 3,061 | 0 | 16 | 1,208 | 1,109 | 584 | 525 | 64 | 7 |
-- | Building hierarchy from unstructured hierarchical paths.
module Language.ImProve.Tree
( Tree (..)
, tree
) where
import Data.Function
import Data.List
data Tree a b
= Branch a [Tree a b]
| Leaf a b
tree :: (Eq a, Ord a) => (b -> [a]) -> [b] -> [Tree a b]
tree path leaves = foldl mergeTrees [] [ sing... | tomahawkins/improve | Language/ImProve/Tree.hs | bsd-3-clause | 1,341 | 0 | 12 | 328 | 706 | 364 | 342 | 34 | 3 |
module D16Lib where
import Data.List
import Data.Maybe
data Step = Spin Int | Exchange Int Int | Partner Char Char deriving (Eq, Show)
type Dancer = Char
iterations :: Int
iterations = 1000000000 -- 1 billion
dancers :: [Dancer]
dancers = ['a'..'p']
run :: [Dancer] -> [Step] -> [Dancer]
run = foldl' step
step ::... | wfleming/advent-of-code-2016 | 2017/D16/src/D16Lib.hs | bsd-3-clause | 1,151 | 0 | 13 | 322 | 598 | 309 | 289 | 36 | 1 |
{-
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998
-}
{-# LANGUAGE CPP, DeriveDataTypeable, FlexibleContexts #-}
{-# LANGUAGE NamedFieldPuns #-}
-- | CoreSyn holds all the main data types for use by for the Glasgow Haskell Compiler midsection
module CoreSyn (
-- * ... | shlevy/ghc | compiler/coreSyn/CoreSyn.hs | bsd-3-clause | 89,300 | 0 | 14 | 23,699 | 9,305 | 5,286 | 4,019 | 654 | 5 |
module Day8 where
import Data.Array.Repa ((:.) (..), All (..), Any (..))
import qualified Data.Array.Repa as Repa
import Data.List (intercalate)
import Text.Megaparsec
import Text.Megaparsec.Lexer hiding (space)
import Text.Megaparsec.String... | liff/adventofcode-2016 | app/Day8.hs | bsd-3-clause | 2,198 | 0 | 14 | 608 | 919 | 477 | 442 | 57 | 1 |
{-# LANGUAGE OverloadedStrings #-}
-----------------------------------------------------------------------------
-- |
-- Module : Hasmin.Parser.BasicShape
-- Copyright : (c) 2017 Cristian Adrián Ontivero
-- License : BSD3
-- Stability : experimental
-- Portability : unknown
--
-- Parsers for CSS <https://w... | contivero/hasmin | src/Hasmin/Parser/BasicShape.hs | bsd-3-clause | 2,399 | 0 | 14 | 474 | 517 | 285 | 232 | 40 | 1 |
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-|
Module : Numeric.AERN.RmToRn
Description : real function operations (except pointwise ones)
Copyright : (c) Michal Konecny
License : BSD3
Maintainer : mikkonecny@gmail.com
... | michalkonecny/aern | aern-realfn/src/Numeric/AERN/RmToRn.hs | bsd-3-clause | 2,570 | 0 | 12 | 424 | 371 | 221 | 150 | 33 | 0 |
module Data.Geo.GPX.Lens.LinksL where
import Data.Geo.GPX.Type.Link
import Data.Lens.Common
class LinksL a where
linksL :: Lens a [Link]
| tonymorris/geo-gpx | src/Data/Geo/GPX/Lens/LinksL.hs | bsd-3-clause | 142 | 0 | 8 | 21 | 45 | 28 | 17 | 5 | 0 |
-----------------------------------------------------------------------------
--
-- The register allocator
--
-- (c) The University of Glasgow 2004
--
-----------------------------------------------------------------------------
{-
The algorithm is roughly:
1) Compute strongly connected components of the basic bloc... | hferreiro/replay | compiler/nativeGen/RegAlloc/Linear/Main.hs | bsd-3-clause | 36,812 | 3 | 25 | 12,983 | 5,716 | 2,922 | 2,794 | -1 | -1 |
module VSim.Data.Line where
data Line = Line {
lineFilename :: FilePath
, lineLine :: Int
, lineColumn :: Int
}
deriving (Show,Eq, Ord)
showLine :: Line -> String
showLine l = lineFilename l ++ ":" ++ show (lineLine l) ++ ":" ++ show (lineColumn l) ++ ":"
| ierton/vsim | src/VSim/Data/Line.hs | bsd-3-clause | 297 | 0 | 11 | 88 | 107 | 58 | 49 | 8 | 1 |
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE OverloadedStrings #-}
module Text.Toml.Types
( Table
, emptyTable
, VTArray
, VArray
, Node (..)
, Explicitness (..)
, isExplicit
, insert
, ToJSON (..)
, ToBsJSON (..)
) where
import Control.Monad (when)
import Text.Parse... | cies/htoml | src/Text/Toml/Types.hs | bsd-3-clause | 8,971 | 0 | 19 | 2,614 | 2,215 | 1,165 | 1,050 | 158 | 11 |
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE OverloadedLists #-}
{-# LANGUAGE DeriveFunctor, DeriveFoldable, DeriveTraversable #-}
-- | A valid transaction must be balanced--that is, for each
-- commodity, the debits must be equal to the credits. This module
-- contains types and functions that help ensure that an e... | massysett/penny | penny/lib/Penny/Ents.hs | bsd-3-clause | 6,273 | 0 | 17 | 1,345 | 1,567 | 856 | 711 | 112 | 2 |
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
module Plot where
import ClassyPrelude as CP
import Graphics.Rendering.Chart.Easy
import Graphics.Rendering.Chart.Backend.Diagrams
import Data.Time hiding (readTime)
import Data.Colour.SRGB
readTime :: TimeZone -> (String, String) -> Either String... | limaner2002/EPC-tools | plots/src/Plot.hs | bsd-3-clause | 2,099 | 0 | 14 | 425 | 622 | 327 | 295 | -1 | -1 |
{-# LANGUAGE GADTs, TypeFamilies, DeriveFunctor, RankNTypes #-}
-- | A data type for computations with requests that can be batched together
-- and possibly executed more efficiently.
--
-- Inspired by Facebook's <https://github.com/facebook/Haxl Haxl>, but the implementation is pure (no IO).
--
-- Things to improve:
-... | zyla/monad-batch | Control/Monad/Batch.hs | bsd-3-clause | 4,520 | 0 | 14 | 1,082 | 984 | 537 | 447 | 53 | 2 |
{-# LANGUAGE OverloadedStrings #-}
import Data.IterIO
import Data.IterIO.Http
import Data.IterIO.HttpClient
import OpenSSL
import qualified OpenSSL.Session as SSL
import qualified Data.ByteString.Char8 as S8
import qualified Data.ByteString.Lazy as L
import System.Environment
import Control.Concurrent
main :: IO ()
m... | scslab/iterIO | Examples/httpClient.hs | bsd-3-clause | 1,088 | 0 | 12 | 175 | 276 | 139 | 137 | 35 | 5 |
import Data.Maybe
import Data.List
-- | A subsequence of a permutation is a collection of elements of the
-- permutation in the order that they appear.
--
-- For example, (5, 3, 4) is a subsequence of (5, 1, 3, 4, 2).
--
-- A subsequence is increasing if the elements of the subsequence increase,
-- and decreasing if t... | mitochon/hoosalind | src/problems/lgis.hs | mit | 3,688 | 0 | 14 | 864 | 1,186 | 644 | 542 | 57 | 3 |
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
-- TODO rename the module / move defintions / whatever.
-- It's not about the network at all.
module Pos.Listener.Update
( UpdateMode
, handleProposal
, handleVote
) where
import Universum
import ... | input-output-hk/pos-haskell-prototype | lib/src/Pos/Listener/Update.hs | mit | 3,847 | 0 | 12 | 1,022 | 816 | 445 | 371 | 80 | 3 |
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE DeriveDataTypeable #-}
-- |
-- Module: Aws.Sns.Commands.Pub... | ababkin/hs-aws-sns | src/Aws/Sns/Commands/Publish.hs | mit | 8,243 | 0 | 26 | 1,724 | 1,323 | 787 | 536 | 150 | 2 |
{-# LANGUAGE TemplateHaskell, FlexibleInstances, DeriveDataTypeable, ViewPatterns #-}
{-# OPTIONS_GHC -fno-warn-incomplete-patterns #-}
-- spurious warnings for view patterns
-- |
-- Copyright : (c) 2011-2012 Benedikt Schmidt
-- License : GPL v3 (see LICENSE)
--
-- Maintainer : Benedikt Schmidt <beschmi@gmail... | ekr/tamarin-prover | lib/term/src/Term/SubtermRule.hs | gpl-3.0 | 2,563 | 0 | 14 | 624 | 593 | 318 | 275 | 43 | 5 |
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
-- ... | olorin/amazonka | amazonka-ec2/gen/Network/AWS/EC2/DescribeVPCPeeringConnections.hs | mpl-2.0 | 7,693 | 0 | 15 | 1,539 | 811 | 497 | 314 | 93 | 1 |
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
-- ... | olorin/amazonka | amazonka-ec2/gen/Network/AWS/EC2/AssociateDHCPOptions.hs | mpl-2.0 | 4,776 | 0 | 11 | 925 | 531 | 326 | 205 | 71 | 1 |
import Sprockell
prog :: [Instruction]
prog = [
Branch regSprID (Rel 6) -- target "beginLoop"
, Load (ImmValue 13) regC
, WriteInstr regC (DirAddr 1) -- Sprockell 1 must jump to second EndProg
, WriteInstr regC (DirAddr 2) -- Sprockell 2 must jump to second EndProg
, ... | wouwouwou/2017_module_8 | src/haskell/PP-project-2017/lib/sprockell-2017/src/DemoMultipleSprockells.hs | apache-2.0 | 935 | 0 | 10 | 321 | 211 | 115 | 96 | 18 | 1 |
module GoToSymbolFunction_BehaveWhenCaretOutsideAFunction where
<caret>
test :: IO Int
test = do
seven <- return 7
return $ seven + 1 | charleso/intellij-haskforce | tests/gold/codeInsight/GoToSymbolFunction_BehaveWhenCaretOutsideAFunction.hs | apache-2.0 | 137 | 3 | 8 | 23 | 47 | 22 | 25 | -1 | -1 |
module Main where
import Data.Monoid
import Options.Applicative
import Server
-- | Argument line options
data Options = Options {
-- | Path to config, if not set, the app will not start
configPath :: FilePath
}
-- | Command line parser
optionsParser :: Parser Options
optionsParser = Options
<$> strOption (
... | NCrashed/servant-auth-token | example/persistent/src/Main.hs | bsd-3-clause | 854 | 0 | 11 | 187 | 178 | 92 | 86 | -1 | -1 |
{-# LANGUAGE FlexibleInstances
#-}
module Cooper where
{-
This file is based upon an implementation of a Pressburger
arithmetic solver written by John Harrison in OCaml which was
copyright (c) 2003. It was translated to Haskell by Tim Sheard in
2006. As a derivative of that work, it is subject to the following
Licen... | cartazio/omega | src/Cooper.hs | bsd-3-clause | 33,374 | 98 | 36 | 8,829 | 15,011 | 7,831 | 7,180 | 680 | 19 |
{-# LANGUAGE DataKinds
, GADTs
, FlexibleContexts
, KindSignatures
, PolyKinds
#-}
{-# OPTIONS_GHC -Wall -fwarn-tabs #-}
----------------------------------------------------------------
-- 2016.04.21
-- |
-- Modul... | zaxtax/hakaru | haskell/Language/Hakaru/Observe.hs | bsd-3-clause | 3,533 | 0 | 26 | 1,052 | 954 | 495 | 459 | 63 | 5 |
module String00003 where
s = "\
\Strings should allow \"escaped double quotes\"\
\as well as multi-line strings. Also, the closing\
\quote of this string can be preceded by a backslash\
\since the backslash indicates line continuation, not\
\quote escaping!\
\" | charleso/intellij-haskforce | tests/gold/parser/String00003.hs | apache-2.0 | 283 | 0 | 4 | 61 | 9 | 6 | 3 | 2 | 1 |
import Control.Concurrent
import Control.Monad
import Data.ByteString.Lazy(pack)
import qualified Data.ByteString.Lazy as BS
import Data.Word
import Hypervisor.Console
import Hypervisor.Debug
import Hypervisor.XenStore
import XenDevice.Disk
main :: IO ()
main = do
writeDebugConsole "Starting system!\n"
con <- init... | thumphries/HaLVM | examples/XenDevice/VBDTest/VBDTest.hs | bsd-3-clause | 3,771 | 0 | 22 | 969 | 1,224 | 571 | 653 | 87 | 2 |
<?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="el-GR">
<title>Linux WebDrivers</title>
<maps>
<homeID>top</homeID>
<mapref location="m... | kingthorin/zap-extensions | addOns/webdrivers/webdriverlinux/src/main/javahelp/org/zaproxy/zap/extension/webdriverlinux/resources/help_el_GR/helpset_el_GR.hs | apache-2.0 | 961 | 77 | 66 | 156 | 407 | 206 | 201 | -1 | -1 |
module B1 where
data Data1 a = C1 a Int Int | C2 Int | C3 Float
g (C1 x y z) = y
g (C2 x) = x
g (C3 x) = 42
| mpickering/HaRe | old/testing/addCon/B1.hs | bsd-3-clause | 121 | 0 | 7 | 47 | 74 | 40 | 34 | 5 | 1 |
module Main (main) where
import qualified HIndent
main :: IO ()
main = return ()
| sighingnow/hindent | src/main/TestGenerate.hs | bsd-3-clause | 83 | 0 | 6 | 17 | 33 | 19 | 14 | 4 | 1 |
{-# LANGUAGE MagicHash, UnboxedTuples #-}
module Bug ( box, wrap, proxy ) where
import GHC.Prim
box :: (# Proxy# a, b #) -> b
box (# x, y #) = y
wrap :: b -> Proxy# a -> (# Proxy# a, b #)
wrap x = \i# -> (# i#, x #)
proxy :: () -> Proxy# a
proxy () = proxy#
| ezyang/ghc | testsuite/tests/ghci/scripts/T12520.hs | bsd-3-clause | 263 | 0 | 8 | 67 | 117 | 64 | 53 | 9 | 1 |
import Data.List (sortBy)
import Data.Word (Word64)
main = putStrLn $ show solve
solve :: Word64
solve = head $ sortBy (\x y -> compare y x) $ digitProducts 13 digits
digitProducts :: Int -> [Word64] -> [Word64]
digitProducts n ds = digitProductsHelper (take n ds) (drop n ds)
where
digitProductsHelper _ [] = [... | pshendry/project-euler-solutions | 0008/solution.hs | mit | 3,545 | 0 | 12 | 1,185 | 3,208 | 2,111 | 1,097 | 31 | 2 |
{-
add :: Num a => a -> a -> a
add x y = x + y
-}
add :: Num a => a -> a -> a
add = (+)
| fmi-lab/fp-elective-2017 | exercises/11/add.hs | mit | 89 | 0 | 7 | 33 | 29 | 16 | 13 | 2 | 1 |
{-# LANGUAGE RecordWildCards #-}
module GhostLang.RuntimeState.Counter
( Counter (..)
, HttpStatus (..)
, emptyCounter
, incPatternExecTime'
, incInstrInvoked'
, incLoopCmds'
, incConcCmds'
, incProcCalls'
, updHttpGETCounters'
, updHttpPUTCounters'
, getProcCalls
, getTo... | kosmoskatten/ghost-lang | ghost-lang/src/GhostLang/RuntimeState/Counter.hs | mit | 5,427 | 0 | 12 | 1,569 | 1,135 | 653 | 482 | 109 | 3 |
{-# LANGUAGE OverloadedStrings #-}
{- Connect4 implementation in Haskell.
- NOTE: I know the comments in this file are a bit much extense. This has been
- on purpose, so in case someone stumbles upon this source code and wants
- to learn Haskell, they can somewhat understand what is going on (while
- helping mysel... | joslugd/connect4-haskell | src/Main.hs | mit | 6,348 | 0 | 19 | 1,805 | 1,139 | 560 | 579 | 111 | 6 |
--------------------------------------------------------------------------------
-- |
-- Module : Network.URL
-- Copyright : (c) Galois, Inc. 2007, 2008
-- License : BSD3
--
-- Maintainer : Iavor S. Diatchki
-- Stability : Provisional
-- Portability : Portable
--
-- Provides a convenient way for working w... | yav/url | Network/URL.hs | mit | 8,585 | 0 | 17 | 2,837 | 2,318 | 1,241 | 1,077 | 155 | 13 |
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE DeriveDataTypeable #-}
module JSDOM.Custom.PositionError (
module Generated
, PositionErrorCode(..)
, PositionException(..)
, throwPositionException
) where
import Prelude ()
import Prelude.Compat
import Data.Typeable (Typeable)
import Control.Exception (Exceptio... | ghcjs/jsaddle-dom | src/JSDOM/Custom/PositionError.hs | mit | 1,050 | 0 | 12 | 157 | 254 | 146 | 108 | 24 | 1 |
import qualified Data.Aeson as Aeson
import qualified Data.ByteString.Lazy as ByteString
import qualified Data.Conf as Conf
import Data.Monoid
import qualified Data.Text.IO as Text
import qualified Data.Yaml as Yaml
import System.Environment
import S... | beijaflor-io/haskell-language-conf | bin/ToConf.hs | mit | 1,102 | 0 | 23 | 421 | 276 | 145 | 131 | 26 | 5 |
module Main where
import LispREPL
import System.Environment
main :: IO ()
main = do args <- getArgs
case length args of
0 -> runRepl
1 -> runOne $ args !! 0
otherwise -> putStrLn "Program takes only 0 or 1 output"
| Bolt64/wyas | src/Main.hs | mit | 268 | 0 | 11 | 95 | 73 | 37 | 36 | 9 | 3 |
{-# LANGUAGE OverloadedStrings, FlexibleContexts #-}
module DiG.Config where
import Data.ByteString.Char8 (ByteString, pack)
import Data.ConfigFile
import Control.Monad.Error
import Data.Either (rights)
data DocSet = DocSet { name :: ByteString
, repo :: ByteString
, prefi... | oforero/DiG | src/DiG/Config.hs | mit | 1,806 | 0 | 17 | 713 | 548 | 278 | 270 | 43 | 2 |
{-# LANGUAGE CPP #-}
#if MIN_VERSION_base(4,8,1)
#define HAS_SOURCE_LOCATIONS
{-# LANGUAGE ImplicitParams #-}
#endif
module Test.Hspec.ExpectationsSpec (spec) where
import Control.Exception
import Data.List
import Test.Hspec (Spec, describe, it)
import Test.HUnit.Lang
import ... | soenkehahn/hspec-expectations | test/Test/Hspec/ExpectationsSpec.hs | mit | 5,213 | 0 | 17 | 1,104 | 1,066 | 535 | 531 | 80 | 1 |
{-# LANGUAGE OverloadedStrings #-}
module Text.Marquee.Writers.HTML (renderHtml, writeHtml, writeHtmlDocument) where
-- Control and Data imports
import Control.Monad (forM_)
import qualified Data.Text as T
import Data.List (intercalate)
-- Blaze imports
import Text.Blaze.Html5 as H
import Text.Blaze.Html5.Attributes... | DanielRS/marquee | src/Text/Marquee/Writers/HTML.hs | mit | 3,395 | 0 | 15 | 782 | 1,270 | 662 | 608 | 66 | 2 |
module ProgrammingInHaskell2.Chap11 where
import Data.Char
import Data.List
import System.IO
size :: Int
size = 3
type Grid = [[Player]]
data Player = O | B | X
deriving (Eq, Ord, Show)
next :: Player -> Player
next O = X
next B = B
next X = O
empty :: Grid
empty = replicate size (replicate size B)
... | akimichi/haskell-labo | src/ProgrammingInHaskell2/Chap11.hs | mit | 504 | 0 | 7 | 119 | 207 | 115 | 92 | 19 | 1 |
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TupleSections #-}
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalyticsv2-application-parallelismconfiguration.html
module Stratosphere.ResourceProperties.KinesisAn... | frontrowed/stratosphere | library-gen/Stratosphere/ResourceProperties/KinesisAnalyticsV2ApplicationParallelismConfiguration.hs | mit | 4,595 | 0 | 13 | 310 | 449 | 255 | 194 | 38 | 1 |
{-
Copyright (C) 2001, 2004 Ian Lynagh <igloo@earth.li>
Modified by Einar Karttunen to remove dependency on packed strings
and autoconf.
Modified by John Meacham for code cleanups.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published ... | dec9ue/jhc_copygc | src/Util/SHA1.hs | gpl-2.0 | 11,601 | 0 | 20 | 3,853 | 5,236 | 2,638 | 2,598 | -1 | -1 |
{-# OPTIONS_GHC -F -pgmF hspec-discover #-}
-- This program 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 License, or (at
-- your option) any later version.
--
-- This program is ... | pharpend/comarkdown | tests/Spec.hs | gpl-3.0 | 693 | 0 | 2 | 122 | 15 | 14 | 1 | 1 | 0 |
-- Copyright (C) 2014 Boucher, Antoni <bouanto@gmail.com>
--
-- This program 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 License, or
-- (at your option) any later version.
--
-... | antoyo/recettesduquebec2tex | src/PrettyPrinter.hs | gpl-3.0 | 3,146 | 0 | 16 | 534 | 801 | 421 | 380 | 29 | 2 |
import Control.Applicative
import Control.Concurrent
import Control.Monad
import Control.Monad.IfElse
import Data.IORef
import Debug.Trace
import FRP.Yampa as Yampa
import Text.Printf
import Game
import Display
import Input
import Graphics.UI.Extra.SDL
main :: IO ()
main = do
initializeDisplay
timeRef <- ... | keera-studios/pang-a-lambda | Experiments/splitballs/Main.hs | gpl-3.0 | 1,269 | 0 | 15 | 388 | 339 | 179 | 160 | 33 | 4 |
{-# LANGUAGE NamedFieldPuns #-}
module Frame.Goaway
( getPayload
, putPayload
, Payload
, mkPayload
, getErrorCode
, getDebugData
, toString
) where
import Data.Binary.Get (Get)
import qualified Data.Binary.Get as Get
import Data.Binary.Put (Put)
import qualified Data.Binary.Put as Put
import C... | authchir/SoSe17-FFP-haskell-http2-server | src/Frame/Goaway.hs | gpl-3.0 | 2,004 | 0 | 13 | 437 | 516 | 289 | 227 | 49 | 2 |
{-# language
FlexibleInstances
#-}
module Rasa.Internal.Utility
( Width
, Height
, Renderable(..)
, RenderInfo(..)
, ScrollPos
, cropToViewport
, styleText
) where
import Eve
import Rasa.Internal.Styles
import Rasa.Internal.BufActions
import Rasa.Internal.Buffer
import Rasa.Internal.Range
import C... | samcal/rasa | rasa/src/Rasa/Internal/Utility.hs | gpl-3.0 | 2,510 | 0 | 14 | 465 | 637 | 337 | 300 | -1 | -1 |
module P11CurrencySpec (main,spec) where
import Test.Hspec
import Test.Hspec.QuickCheck
import P11Currency hiding (main)
import Text.Printf (printf)
main :: IO ()
main = hspec spec
spec = do
describe "getDollars" $ do
prop "has the property of showing twice any number when the rateTo is 200 (i.e. 200%)" $
... | ciderpunx/57-exercises-for-programmers | test/P11CurrencySpec.hs | gpl-3.0 | 710 | 0 | 15 | 151 | 198 | 104 | 94 | 16 | 1 |
-- | Mathematical utility functions.
module Util.Maths (percentage,
roundUp) where
-- | Calculate the first argument as a percentage of the second.
percentage :: Int -> Int -> Float
percentage num denom = fromIntegral (num * 100) / fromIntegral denom
-- | Round-up integer n to the nearest m. E.g. ... | dwdyer/anorak | src/haskell/Util/Maths.hs | gpl-3.0 | 407 | 0 | 9 | 97 | 101 | 56 | 45 | 6 | 1 |
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE RecordWildCards #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
-- |
-- Module : Network.Bouquet
-- Copyright : (c) 2013 Kim Altintop <kim.altintop@gmail.com>
-- License : This Source Code Form i... | kim/bouquet | src/Network/Bouquet.hs | mpl-2.0 | 9,348 | 0 | 25 | 2,904 | 2,446 | 1,282 | 1,164 | 176 | 3 |
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators ... | brendanhay/gogol | gogol-plus/gen/Network/Google/Resource/Plus/Activities/List.hs | mpl-2.0 | 4,327 | 0 | 16 | 977 | 561 | 333 | 228 | 83 | 1 |
module Shapes
( Point(..)
, Shape(..)
, area
, nudge
, baseCircle
, baseRect
) where
data Point = Point Float Float deriving (Show)
data Shape = Circle Point Float | Rectangle Point Point
deriving (Show)
area :: Shape -> Float
area (Circle _ r) = pi * r^2
area (Rectangle (Point x1 y1) (Point x2 y2)) = (abs $ x2 - ... | alexliew/learn_you_a_haskell | code/shapes.hs | unlicense | 747 | 0 | 9 | 161 | 397 | 211 | 186 | 20 | 1 |
module Traffic
(TrafficLight(..)
)where
data TrafficLight = Red | Yellow | Green
instance Eq TrafficLight where
Red == Red = True
Yellow == Yellow = True
Green == Green = True
_ == _ = False
instance Show TrafficLight where
show Red = "Red light"
show Yellow = "Yellow light"
show Green =... | EricYT/Haskell | src/chapter-7-4.hs | apache-2.0 | 335 | 0 | 6 | 87 | 110 | 57 | 53 | 12 | 0 |
module Handler.AboutUs where
import Import
getAboutUsR :: Handler RepHtml
getAboutUsR = defaultLayout $ do
liftIO $ logd "GET AboutUs"
h2id <- lift newIdent
setTitle "WebToInk AboutUs"
$(widgetFile "aboutUs")
| thlorenz/WebToInk | webtoink/Handler/AboutUs.hs | bsd-2-clause | 228 | 0 | 10 | 47 | 62 | 29 | 33 | 8 | 1 |
{-# OPTIONS -fglasgow-exts #-}
-----------------------------------------------------------------------------
{-| Module : QPrintDialog.hs
Copyright : (c) David Harley 2010
Project : qtHaskell
Version : 1.1.4
Modified : 2010-09-02 17:02:21
Warning : this file is machine generated - do ... | keera-studios/hsQt | Qtc/Gui/QPrintDialog.hs | bsd-2-clause | 46,365 | 0 | 14 | 7,401 | 14,919 | 7,564 | 7,355 | -1 | -1 |
{-# LANGUAGE CPP #-}
#if __GLASGOW_HASKELL__ >= 701
{-# LANGUAGE Trustworthy #-}
#endif
--
-- |
-- Module : System.Environment.UTF8
-- Copyright : (c) Eric Mertens 2009
-- License : BSD3-style (see LICENSE)
--
-- Maintainer: emertens@galois.com
-- Stability : experimental
-- Portability : portable
... | ghc/packages-utf8-string | System/Environment/UTF8.hs | bsd-3-clause | 1,076 | 0 | 8 | 179 | 258 | 153 | 105 | 18 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.