100+ results for 'haskell =<<'

Not the results you expected?

Theme.hs (https://github.com/Peaker/lamdu.git) Haskell · 177 lines

1 {-# OPTIONS -O0 #-}

2 {-# LANGUAGE TemplateHaskell, MultiParamTypeClasses, TypeFamilies #-}

3

4 -- | The themes/ config format

Json.hs (https://github.com/input-output-hk/cardano-sl.git) Haskell · 277 lines

1 {-# LANGUAGE TemplateHaskell #-}

2

3 module Test.Pos.Chain.Genesis.Json

NewHaskellFileAction.java (https://github.com/makido/ideah.git) Java · 141 lines

24 public final class NewHaskellFileAction extends CreateElementActionBase {

25

26 private static final String WHAT = "Haskell module";

27

28 public NewHaskellFileAction() {

29 super(WHAT, "Creates new " + WHAT, HaskellFileType.HASKELL_ICON); // todo: another icon?

30 }

31

32 @NotNull

33 protected PsiElement[] invokeDialog(Project project, PsiDirectory directory) {

34 if (!isHaskellModule(project, directory)) {

35 Messages.showErrorDialog(project, "Cannot create " + WHAT + " in non-Haskell project", "Wrong module");

49 throw new IncorrectOperationException("A name should be specified.");

50 }

51 HaskellFileType type = HaskellFileType.INSTANCE;

52 String ext = type.getDefaultExtension();

53 Project project = directory.getProject();

Unpack.hs (https://github.com/netconstructor/msgpack.git) Haskell · 323 lines

21 -- * MessagePack deserializer

22 Unpackable(..),

23 -- * Simple function to unpack a Haskell value

24 unpack,

25 tryUnpack,

72 instance Exception UnpackError

73

74 -- | Unpack MessagePack string to Haskell data.

75 unpack :: (Unpackable a, IsByteString s) => s -> a

76 unpack bs =

81 ret

82

83 -- | Unpack MessagePack string to Haskell data.

84 tryUnpack :: (Unpackable a, IsByteString s) => s -> Either String a

85 tryUnpack bs =

Hash.hs (https://github.com/sajith/accelerate.git) Haskell · 143 lines

117 {-

118 -- hash function from the dragon book pp437; assumes 7 bit characters and needs

119 -- the (nearly) full range of values guaranteed for `Int' by the Haskell

120 -- language definition; can handle 8 bit characters provided we have 29 bit for

121 -- the `Int's without sign

Format.hs (https://github.com/upwawet/vision.git) Haskell · 194 lines

1 -- -*-haskell-*-

2 -- Vision (for the Voice): an XMMS2 client.

3 --

140

141 loadFormatDefs = do

142 putFormatDefs' . map trim =<< config "playlist-formats.conf" builtinFormats

143 updateFormats False

144 where builtinFormats =

163

164 saveFormatDefs = do

165 writeConfig "playlist-formats.conf" =<< getFormatDefs

166 return ()

167

169

170 updateFormats notify = do

171 putMakeInfo =<< makeMakeInfo =<< getFormats

172 when notify $ atomically $ do

173 g <- readTVar formatsGeneration

FromHaRe.hs (https://github.com/haskell/haskell-ide-engine.git) Haskell · 221 lines

28 import qualified Data.Generics as SYB

29

30 -- import Language.Haskell.GHC.ExactPrint

31 -- import Language.Haskell.GHC.ExactPrint.Annotate

32 -- import Language.Haskell.GHC.ExactPrint.Parsers

33 import Language.Haskell.GHC.ExactPrint.Utils

58 parsed = GHC.pm_parsed_source $ GHC.tm_parsed_module tm

59 renamed = GHC.tm_renamed_source tm

60 #if __GLASGOW_HASKELL__ > 710

61 typechecked = GHC.tm_typechecked_source tm

62 #endif

110 #if __GLASGOW_HASKELL__ >= 806

111 namesIe = names

112 #elif (defined(MIN_VERSION_GLASGOW_HASKELL) && (MIN_VERSION_GLASGOW_HASKELL(8,2,1,0)))

113 -- This is a workaround for https://ghc.haskell.org/trac/ghc/ticket/14189

UTF8.hs (https://github.com/khskrede/mehh.git) Haskell · 209 lines

40 import Codec.Binary.UTF8.Generic (buncons)

41

42 -- | Converts a Haskell string into a UTF8 encoded bytestring.

43 fromString :: String -> B.ByteString

44 fromString xs = B.pack (encode xs)

45

46 -- | Convert a UTF8 encoded bytestring into a Haskell string.

47 -- Invalid characters are replaced with '\xFFFD'.

48 toString :: B.ByteString -> String

FDB.hs (https://github.com/GunioRobot/tokyocabinet-haskell.git) Haskell · 268 lines

96

97 -- | Free FDB resource forcibly.

98 -- FDB is kept by ForeignPtr, so Haskell runtime GC cleans up memory for

99 -- almost situation. Most always, you don't need to call this.

100 -- After call this, you must not touch FDB object. Its behavior is undefined.

150 out fdb key =

151 withForeignPtr (unTCFDB fdb) $ \fdb' ->

152 c_tcfdbout fdb' =<< keyToInt key

153

154 -- | Return the value of record.

166 vsiz fdb key =

167 withForeignPtr (unTCFDB fdb) $ \fdb' -> do

168 vsize <- c_tcfdbvsiz fdb' =<< keyToInt key

169 return $ if vsize == (-1)

170 then Nothing

AndroidLintSummary.hs (https://github.com/passy/android-lint-summary.git) Haskell · 253 lines

3 {-# LANGUAGE NoImplicitPrelude #-}

4 {-# LANGUAGE OverloadedStrings #-}

5 {-# LANGUAGE TemplateHaskell #-}

6 -- | Parsers and pretty printers for the `lint-results.xml` file format.

7 module AndroidLintSummary (

204

205 openXMLFile :: forall s b. FilePath -> IO (IOStateArrow s b XmlTree)

206 openXMLFile = (readXMLFileHandle =<<) . getHandle

207 where

208 getHandle filepath

CRUDIncremental.hs (https://github.com/killerswan/reactive-banana.git) Haskell · 264 lines

71 where

72 lookup database m = fromMaybe ("","") $

73 readDatabase database =<< m

74

75 -- automatically enable / disable editing

249

250 {-----------------------------------------------------------------------------

251 wxHaskell bug fixes

252 ------------------------------------------------------------------------------}

253 -- Fix @select@ event not being fired when items are *un*selected

DocsInHiFileTH.hs (https://github.com/bgamari/ghc.git) Haskell · 218 lines

1 {-# LANGUAGE TemplateHaskell, FlexibleInstances, TypeFamilies, DataKinds #-}

2 {-# LANGUAGE MultiParamTypeClasses, StandaloneKindSignatures, PolyKinds #-}

3 {-# LANGUAGE PatternSynonyms #-}

6 module DocInHiFilesTH where

7

8 import Language.Haskell.TH

9 import Language.Haskell.TH.Syntax

86 do

87 Just "A fancy class" <- getDoc (DeclDoc ''C)

88 Just "A fancy instance" <- getDoc . InstDoc =<< [t| C Int |]

89 Just "Another fancy instance" <- getDoc (InstDoc (AppT (ConT ''D) (VarT (mkName "a"))))

90 Just "Another fancy instance" <- getDoc (InstDoc (AppT (ConT ''D) (VarT (mkName "b"))))

91 Nothing <- getDoc . InstDoc =<< [t| C String |]

92

93 putDoc (DeclDoc ''C) "A new class"

Form.purs (https://github.com/thomashoneyman/purescript-halogen-formless.git) PureScript · 202 lines

176 }

177 [ singleTypeahead Language

178 { placeholder: "Haskell"

179 , items:

180 [ "Rust"

interpreter.hs (http://fppr2010.googlecode.com/svn/trunk/) Haskell · 107 lines

1 -- | Dieses Modul implementiert einen interaktiven Interpreter fuer Concurrent Haskell with Futures

2

3 import System.IO -- benoetigt fuer hFlush

4 import Control.Exception(try,IOException,SomeException,evaluate) -- benoetigt fuer evaluate/try/...

5 import Data.IORef -- benoetigt fuer IORef

6 import CHF.Run as CHF -- Concurrent Haskell with Futures

7

8 ----------------------------------------------------------------------------------------------------------

9 -- | 'getInputString' Wrapper fuer getLine. (Liefert auf jeden Fall einen String.)

10 -- Als Parameter kann eine Eingabaufforderung Uebergeben werden. Der Trick mit hFlush aus System.IO

11 -- stammt von http://www.haskell.org/pipermail/haskell/2006-September/018430.html

12 -- und sorgt dafuer, dass sich das Programm in GHCI genauso verhaellt, wie die kompilierte .exe-Datei!

13 ----------------------------------------------------------------------------------------------------------

35 run :: IO ()

36 run = do

37 putStrLn "Concurrent Haskell with Futures (CHF) [Nhan/Leppin]"

38 putStrLn "===================================================="

39 putStrLn "Beenden :quit / Hilfe :help"

TH.hs (https://github.com/kaizhang/SciFlow.git) Haskell · 183 lines

1 {-# LANGUAGE TemplateHaskell #-}

2 {-# LANGUAGE FlexibleContexts #-}

3 {-# LANGUAGE OverloadedStrings #-}

10 import Control.Arrow (arr, (>>>))

11 import qualified Data.Text as T

12 import Language.Haskell.TH

13 import Instances.TH.Lift ()

14 import qualified Data.HashMap.Strict as M

23 import Control.Workflow.Language.TH.Internal

24

25 -- | Generate template haskell codes to build the workflow.

26 build :: String -- ^ The name of the compiled workflow.

27 -> TypeQ -- ^ The workflow signature.

haskell.md (https://github.com/donnemartin/viz.git) Markdown · 56 lines

1 # Haskell

2

3 ## Most-Starred Repos: Haskell

7 | 1. | [haskus/haskus-system](https://github.com/haskus/haskus-system) <br/>Haskus system | 267 |

8

9 ## Most-Starred Users: Haskell

10

11 | | User | Repos | Stars |

12 |---|---|---|---|

13

14 ## Most-Starred Orgs: Haskell

15

16 | | Org | Repos | Stars |

48 | CoffeeScript | [Repos](https://github.com/donnemartin/gh-stats/blob/master/language_stats/2016/coffeescript.md#most-starred-repos-coffeescript) - [Users](https://github.com/donnemartin/gh-stats/blob/master/language_stats/2016/coffeescript.md#most-starred-users-coffeescript) - [Orgs](https://github.com/donnemartin/gh-stats/blob/master/language_stats/2016/coffeescript.md#most-starred-orgs-coffeescript) |

49 | Lua | [Repos](https://github.com/donnemartin/gh-stats/blob/master/language_stats/2016/lua.md#most-starred-repos-lua) - [Users](https://github.com/donnemartin/gh-stats/blob/master/language_stats/2016/lua.md#most-starred-users-lua) - [Orgs](https://github.com/donnemartin/gh-stats/blob/master/language_stats/2016/lua.md#most-starred-orgs-lua) |

50 | Haskell | [Repos](https://github.com/donnemartin/gh-stats/blob/master/language_stats/2016/haskell.md#most-starred-repos-haskell) - [Users](https://github.com/donnemartin/gh-stats/blob/master/language_stats/2016/haskell.md#most-starred-users-haskell) - [Orgs](https://github.com/donnemartin/gh-stats/blob/master/language_stats/2016/haskell.md#most-starred-orgs-haskell) |

51 | VimL | [Repos](https://github.com/donnemartin/gh-stats/blob/master/language_stats/2016/viml.md#most-starred-repos-viml) - [Users](https://github.com/donnemartin/gh-stats/blob/master/language_stats/2016/viml.md#most-starred-users-viml) - [Orgs](https://github.com/donnemartin/gh-stats/blob/master/language_stats/2016/viml.md#most-starred-orgs-viml) |

52 | R | [Repos](https://github.com/donnemartin/gh-stats/blob/master/language_stats/2016/r.md#most-starred-repos-r) - [Users](https://github.com/donnemartin/gh-stats/blob/master/language_stats/2016/r.md#most-starred-users-r) - [Orgs](https://github.com/donnemartin/gh-stats/blob/master/language_stats/2016/r.md#most-starred-orgs-r) |

Configure.hs (https://github.com/Lainepress/hp-2009.2.0.2.git) Haskell · 210 lines

6 -- License : BSD-like

7 --

8 -- Maintainer : cabal-devel@haskell.org

9 -- Portability : portable

10 --

139 planLocalPackage verbosity comp configFlags configExFlags installed

140 (AvailablePackageDb _ availablePrefs) = do

141 pkg <- readPackageDescription verbosity =<< defaultPackageDesc verbosity

142 let -- The trick is, we add the local package to the available index and

143 -- remove it from the installed index. Then we ask to resolve a

VectorScalar.c (https://bitbucket.org/haskellnumerics/vector-vectorized.git) C · 261 lines

226 // name mangling the complex dot products because I need to

227 // wrap them to take a singlen array pointer where I write the result

228 // because haskell currently doesn't have an FFI story for structs and complex numbers

229 DotProductScalarArray(arrayDotProduct_internal,complextimes,complex_double,0.0 + I*0.0)

230 DotProductScalarArray(arrayDotProduct_internal,complextimes,complex_float,0.0f + I*0.0f)

Eval.hs (https://github.com/Peaker/lamdu.git) Haskell · 269 lines

1 {-# LANGUAGE TemplateHaskell, TypeApplications, RecordWildCards, ScopedTypeVariables, KindSignatures #-}

2 {-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, DefaultSignatures #-}

3

installation.md (https://github.com/owickstrom/komposition.git) Markdown · 175 lines

32

33 Komposition can be built on macOS, Windows, and Linux. If you're not

34 an experienced Haskell developer, it's recommended to use

35 [Stack](https://docs.haskellstack.org/en/stable/README/) to build the

36 application. The following instructions will be based on Stack, so go

37 ahead and [install that

38 first](https://docs.haskellstack.org/en/stable/README/#how-to-install).

39

40 !!! note "Using another build tool"

41 If you know your way around building Haskell programs, you might want to

42 build it using Nix or regular Cabal, instead.

43

Form1.Designer.cs (https://github.com/Lomeli12/Notepad-Sharp.git) C# · 893 lines

84 this.gui4CliToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();

85 this.hToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();

86 this.haskellToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();

87 this.hTMLToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();

88 this.iNNOToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();

605 //

606 this.hToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {

607 this.haskellToolStripMenuItem,

608 this.hTMLToolStripMenuItem});

609 this.hToolStripMenuItem.Name = "hToolStripMenuItem";

613 // haskellToolStripMenuItem

614 //

615 this.haskellToolStripMenuItem.Name = "haskellToolStripMenuItem";

616 this.haskellToolStripMenuItem.Size = new System.Drawing.Size(107, 22);

617 this.haskellToolStripMenuItem.Text = "Haskell";

618 this.haskellToolStripMenuItem.Click += new System.EventHandler(this.haskellToolStripMenuItem_Click);

IE.hs (https://github.com/lspitzner/brittany.git) Haskell · 184 lines

1 module Language.Haskell.Brittany.Internal.Layouters.IE

2 ( layoutIE

3 , layoutLLIEs

8 #include "prelude.inc"

9

10 import Language.Haskell.Brittany.Internal.Types

11 import Language.Haskell.Brittany.Internal.LayouterBasics

12 import Language.Haskell.Brittany.Internal.Config.Types

13

14 import GHC ( unLoc

26 import BasicTypes

27

28 import Language.Haskell.Brittany.Internal.Utils

29

30

Parser.hs (https://github.com/serras/scion-class-browser.git) Haskell · 168 lines

9 import Database.Persist.Sqlite

10 import Database.Persist.Store

11 import Language.Haskell.Exts.Annotated.Syntax

12 import Scion.PersistentBrowser.DbTypes

13 import Scion.PersistentBrowser.Parser.Internal

Context.hs (https://github.com/mrkgnao/silica.git) Haskell · 366 lines

7 {-# LANGUAGE MultiParamTypeClasses #-}

8 {-# LANGUAGE FunctionalDependencies #-}

9 #if __GLASGOW_HASKELL__ >= 707

10 {-# LANGUAGE RoleAnnotations #-}

11 #endif

289 newtype PretextT p (g :: * -> *) a b t = PretextT { runPretextT :: forall f. Functor f => p a (f b) -> f t }

290

291 #if __GLASGOW_HASKELL__ >= 707

292 -- really we want PretextT p g a b t to permit the last 3 arguments to be representational iff p and f accept representational arguments

293 -- but that isn't currently an option in GHC

Data.hs (git://pkgs.fedoraproject.org/ghc-derive) Haskell · 156 lines

45

46 import Data.Derive.DSL.HSE

47 import qualified Language.Haskell as H

48

49 -- GENERATED START

Async.hs (https://github.com/polysemy-research/polysemy.git) Haskell · 141 lines

1 {-# LANGUAGE TemplateHaskell #-}

2

3 module Polysemy.Async

81 pureT $ inspect ins <$> fa

82

83 Await a -> pureT =<< embed (A.wait a)

84 Cancel a -> pureT =<< embed (A.cancel a)

135 pureT $ inspect ins <$> fa

136

137 Await a -> pureT =<< embed (A.wait a)

138 Cancel a -> pureT =<< embed (A.cancel a)

Widget.hs (https://github.com/yogsototh/yesod.git) Haskell · 274 lines

5 {-# LANGUAGE FlexibleInstances #-}

6 {-# LANGUAGE TypeFamilies #-}

7 {-# LANGUAGE TemplateHaskell #-}

8 {-# LANGUAGE MultiParamTypeClasses #-}

9 {-# LANGUAGE TypeSynonymInstances #-}

60 import Data.Text (Text)

61 import qualified Data.Map as Map

62 import Language.Haskell.TH.Quote (QuasiQuoter)

63 import Language.Haskell.TH.Syntax (Q, Exp (InfixE, VarE, LamE, AppE), Pat (VarP), newName)

Registration.hs (https://github.com/gitpan/Language-Haskell.git) Haskell · 162 lines

22 import Data.IORef ( IORef, newIORef, readIORef, writeIORef, modifyIORef )

23 import Foreign.C.Types ( CInt, CUInt )

24 import Foreign.Ptr ( FunPtr, nullFunPtr, freeHaskellFunPtr )

25 import System.IO.Unsafe ( unsafePerformIO )

26 import Graphics.Rendering.OpenGL.GL.StateVar ( HasGetter(get) )

61

62 --------------------------------------------------------------------------------

63 -- This seems to be a common Haskell hack nowadays: A plain old global variable

64 -- with an associated mutator. Perhaps some language/library support is needed?

65

95 --------------------------------------------------------------------------------

96 -- Another global mutable variable: The list of function pointers ready to be

97 -- freed by freeHaskellFunPtr

98

99 {-# notInline theCleanupList #-}

websockets.cabal (https://github.com/yihuang/websockets.git) Cabal · 128 lines

3

4 Synopsis:

5 A sensible and clean way to write WebSocket-capable servers in Haskell.

6

7 Description:

90 Test-suite websockets-tests

91 Type: exitcode-stdio-1.0

92 Hs-source-dirs: src tests/haskell

93 Main-is: TestSuite.hs

94 Ghc-options: -Wall

MongoDB.hs (https://bitbucket.org/calxi/snaplet-mongodb.git) Haskell · 152 lines

1 {-# LANGUAGE TemplateHaskell, TypeFamilies, QuasiQuotes #-}

2

3 -- | This module containes MongoDB backend implementation

98 instance MongoValue A.Array where

99 toValue a = toValue $ V.toList a

100 fromValue v = return . V.fromList =<< fromValue v

101 ----------------------------------------------------------------------

102 instance MongoValue (HashMap T.Text A.Value) where

112 toKV :: (Applicative m, Monad m) => Bson.Value -> ErrorT String m (T.Text, A.Value)

113 toKV (Bson.Doc d) = do

114 key <- fromValue =<< Bson.look (u "key") d

115 value <- fromValue =<< Bson.look (u "value") d

Anonymous.hs (https://gitlab.com/kranium/cabal) Haskell · 315 lines

78 arch :: Arch,

79

80 -- | The Haskell compiler (and hopefully version) used

81 compiler :: CompilerId,

82

196 parseFields :: String -> ParseResult BuildReport

197 parseFields input = do

198 fields <- mapM extractField =<< readFields input

199 let merged = mergeBy (\desc (_,name,_) -> compare (fieldName desc) name)

200 sortedFieldDescrs

sumeuler.hs (git://github.com/PatrickMaier/HdpH.git) Haskell · 172 lines

7 -----------------------------------------------------------------------------

8

9 {-# LANGUAGE TemplateHaskell #-}

10

11 module Main where

59 par_sum_totient :: Int -> Int -> Int -> IO Integer

60 par_sum_totient lower upper chunksize =

61 sum <$> (mapM join =<< (mapM fork_sum_euler $ chunked_list))

62 where

63 chunked_list = chunk chunksize [upper, upper - 1 .. lower] :: [[Int]]

80 nodes <- allNodes

81 let chunks_round_robin = zip chunked_list (cycle nodes)

82 sum <$> (mapM join =<< (mapM push_sum_euler $ chunks_round_robin))

83 where

84 chunked_list = chunk chunksize [upper, upper - 1 .. lower] :: [[Int]]

Input.hs (https://gitlab.com/pavelkogan/reflex-dom) Haskell · 322 lines

1 {-# LANGUAGE ConstraintKinds, TypeFamilies, FlexibleContexts, DataKinds, GADTs, ScopedTypeVariables, FlexibleInstances, RecursiveDo, TemplateHaskell #-}

2 module Reflex.Dom.Widget.Input (module Reflex.Dom.Widget.Input, def, (&), (.~)) where

3

52 textInput :: MonadWidget t m => TextInputConfig t -> m (TextInput t)

53 textInput (TextInputConfig inputType initial eSetValue dAttrs) = do

54 e <- liftM castToHTMLInputElement $ buildEmptyElement "input" =<< mapDyn (Map.insert "type" inputType) dAttrs

55 liftIO $ htmlInputElementSetValue e initial

56 performEvent_ $ fmap (liftIO . htmlInputElementSetValue e) eSetValue

142 checkboxView :: MonadWidget t m => Dynamic t (Map String String) -> Dynamic t Bool -> m (Event t Bool)

143 checkboxView dAttrs dValue = do

144 e <- liftM castToHTMLInputElement $ buildEmptyElement "input" =<< mapDyn (Map.insert "type" "checkbox") dAttrs

145 eClicked <- wrapDomEvent e elementOnclick $ do

146 preventDefault

167 fileInput :: MonadWidget t m => FileInputConfig t -> m (FileInput t)

168 fileInput (FileInputConfig dAttrs) = do

169 e <- liftM castToHTMLInputElement $ buildEmptyElement "input" =<< mapDyn (Map.insert "type" "file") dAttrs

170 eChange <- wrapDomEvent e elementOnchange $ liftIO $ do

171 Just files <- htmlInputElementGetFiles e

ghc-8.2.1_rc1-win32-cross-1.patch (https://gitlab.com/argent/portage) Patch · 124 lines

15

16 Ths change workarounds hsc2hs bug in cross-compile mode:

17 https://ghc.haskell.org/trac/ghc/ticket/13619

18

19 To reproduce the build failure it's enough to run

26

27 This change workarounds hsc2hs bug in cross-compile mode:

28 https://ghc.haskell.org/trac/ghc/ticket/13620

29

30 To reproduce the build failure it's enough to run

109 +-- Have to define enum values outside previous declaration due to

110 +-- hsc2hs bug in --cross-compile mode:

111 +-- https://ghc.haskell.org/trac/ghc/ticket/13620

112 +#ifdef MAPI_LOGOFF_SHARED

113 +#{enum MapiFlag,

LanguagePragmas.hs (https://gitlab.com/alx741/stylish-haskell) Haskell · 168 lines

1 --------------------------------------------------------------------------------

2 module Language.Haskell.Stylish.Step.LanguagePragmas

3 ( Style (..)

4 , step

11 --------------------------------------------------------------------------------

12 import qualified Data.Set as S

13 import qualified Language.Haskell.Exts as H

14

15

16 --------------------------------------------------------------------------------

17 import Language.Haskell.Stylish.Block

18 import Language.Haskell.Stylish.Editor

19 import Language.Haskell.Stylish.Step

20 import Language.Haskell.Stylish.Util

Dispatch.hs (https://github.com/bjornbm/yesod.git) Haskell · 194 lines

1 {-# LANGUAGE TemplateHaskell #-}

2 {-# LANGUAGE CPP #-}

3 {-# LANGUAGE OverloadedStrings #-}

32 import Web.PathPieces (SinglePiece (..), MultiPiece (..))

33 import Yesod.Internal.RouteParsing (THResource, Pieces (..), createRoutes, createRender, Resource (..), parseRoutes, parseRoutesFile)

34 import Language.Haskell.TH.Syntax

35

36 import qualified Network.Wai as W

IEditorPreferenceNames.java (https://github.com/thiagoarrais/eclipsefp.git) Java · 84 lines

1 // Copyright (c) 2003-2005 by Leif Frenzel - see http://leiffrenzel.de

2 package net.sf.eclipsefp.haskell.ui.internal.preferences.editor;

3

4 import org.eclipse.ui.texteditor.AbstractTextEditor;

5

6 /** <p>contains the preference names for the Haskell editor.</p>

7 *

8 * @author Leif Frenzel

Builder.hs (https://github.com/elm-lang/elm-compiler.git) Haskell · 530 lines

11

12 -- Based on the language-ecmascript package.

13 -- https://hackage.haskell.org/package/language-ecmascript

14 -- They did the hard work of reading the spec to figure out

15 -- how all the types should fit together.

HcPkg.hs (https://github.com/khskrede/mehh.git) Haskell · 277 lines

4 -- Copyright : Duncan Coutts 2009

5 --

6 -- Maintainer : cabal-devel@haskell.org

7 -- Portability : portable

8 --

BF.hs (https://github.com/mainland/haskell-src-meta.git) Haskell · 182 lines

1 {-# LANGUAGE BangPatterns, TemplateHaskell #-}

2

3 module Language.Haskell.Meta.QQ.BF (

5 ) where

6

7 import Language.Haskell.Meta (parsePat)

8 import Language.Haskell.TH.Lib

9 import Language.Haskell.TH.Quote

10 import Language.Haskell.TH.Syntax

85 where go (D p m) = return (p, m)

86 go (W n s) = putChar (chr n) >> go s

87 go (R cont) = go . cont . ord =<< getChar

88

89 run :: Ptr -> Mem -> [Bf] -> Status

Event.hs (https://gitlab.com/platonic/shpadoinkle) Haskell · 207 lines

54 mkWithFormVal :: (JSVal -> JSM v) -> Text -> JSString -> (v -> Continuation m a) -> (Text, Prop m a)

55 mkWithFormVal valTo evt from f = listenRaw evt $ \(RawNode n) _ ->

56 f <$> liftJSM (valTo =<< unsafeGetProp from =<< valToObject n)

57

58

74 mkOnKey :: Text -> (KeyCode -> Continuation m a) -> (Text, Prop m a)

75 mkOnKey t f = listenRaw t $ \_ (RawEvent e) ->

76 f <$> liftJSM (fmap round $ valToNumber =<< unsafeGetProp "keyCode" =<< valToObject e)

77

78

154 void $ jsg ("window" :: Text) ^. js2 ("addEventListener" :: Text) evtName

155 (fun $ \_ _ -> \case

156 e:_ -> notify . round =<< valToNumber =<< unsafeGetProp "keyCode" =<< valToObject e

157 [] -> return ())

158

CaseCheck.lhs (git://pkgs.fedoraproject.org/curry) Haskell · 245 lines

13 \begin{itemize}

14 \item \emph{Free mode}: No constraints on the case of identifiers.

15 \item \emph{Haskell mode}: Constructor names should start with an

16 upper case letter, function and variable names with a lower case

17 letter. In addition, data constructor symbol names should start with

30 \emph{TypeConstrId}, \emph{TypeVarId}, \emph{DataConstrId},

31 \emph{FunctionId}, and \emph{VariableId}. At present, we do not check

32 module names, even though Haskell requires them to start with an upper

33 case letter.

34 \begin{verbatim}

61 > check :: CaseMode -> [Definition] -> [String]

62 > check FreeMode = const []

63 > check HaskellMode = checkWith haskellMode

64 > check PrologMode = checkWith prologMode

65 > check GoedelMode = checkWith goedelMode

Setup.hs (https://github.com/RefactoringTools/HaRe.git) Haskell · 89 lines

1 #!/usr/bin/runhaskell

2

3 import Distribution.Simple

4 import Distribution.Simple.Setup (ConfigFlags (..))

5 import Distribution.PackageDescription (emptyHookedBuildInfo,HookedBuildInfo(..))

6 import Language.Haskell.HsColour (hscolour,Output(CSS))

7 import Language.Haskell.HsColour.Colourise (defaultColourPrefs)

21 putStr "Generating custom html documentation... "

22 -- file <- readFile "data/astview-tmpl.html"

23 replaced <- mapM replaceOrEcho . lines =<< readFile "data/astview-tmpl.html"

24

25 putStrLn " done."

28

29 -- echoes the current line, or, if mymatch succeeds:

30 -- replaces the line with colourized haskell code.

31 replaceOrEcho :: String -> IO [String]

32 replaceOrEcho s =

Message.hs (https://github.com/repos-haskell/yesod.git) Haskell · 259 lines

1 {-# LANGUAGE TemplateHaskell #-}

2 {-# LANGUAGE MultiParamTypeClasses #-}

3 {-# LANGUAGE FlexibleInstances #-}

11 ) where

12

13 import Language.Haskell.TH.Syntax

14 import Data.Text (Text, pack, unpack)

15 import System.Directory

UserManual.html (https://github.com/ian-ross/diagrams-doc.git) HTML · 16 lines

1 <p>It's time to start writing a user manual for <a href="http://project.haskell.org/diagrams">diagrams</a>. Haddock documentation is great when you have only, say, forgotten the type of the <code>frobnitz</code> function. However, it is woefully inadequate when you are just trying to figure out how to wibble your fromps (it turns out, of course, that <code>frobnitz</code> is quite general and can be used for, among other things, wibbling fromps; but how would you know to look in the <code>Diagrams.Frobnostication</code> module in the first place?).</p>

2 <p>So I'm looking for tools I can use to help write and publish the manual. For something short like a <a href="http://project.haskell.org/diagrams/tutorial.html">tutorial</a>, <a href="http://johnmacfarlane.net/pandoc/">pandoc</a> works like a charm, but the user manual is going to be a much larger and more complex beast. Here are my requirements. I want to:</p>

4 <li>write in Markdown (or some similar sort of markup language);</li>

5 <li>have the ability to generate not just a single HTML file, but multiple ones with appropriate next/previous links, a table of contents, and so on</li>

6 <li>include Haskell code and generate a syntax-highlighted version in the output. The source (or something easily generated from the source) should also be an actual, valid literate Haskell file that people can load in <code>ghci</code>;</li>

7 <li>have good support for internal hyperlinks, so different parts of the manual can easily link to one another.</li>

8 </ul>

9 <p>And some &quot;nice-to-have&quot; features:</p>

10 <ul>

11 <li>I'd like easy hooks into the build process, so I can (for example) replace certain snippets of Haskell code with links to the images generated by the code.</li>

12 <li>I'd like to be able to incorporate <a href="http://hackage.haskell.org/package/doc%2Dreview"><code>doc-review</code></a>, or something like it, so people can comment on each paragraph in the manual.</li>

13 <li>I want to mark some regions as &quot;collapsible&quot; so they will initially be displayed as just a &quot;placeholder&quot; of some sort which can be expanded and collapsed by clicking. These could include things like extra technical information which many readers will not care about, extra explanation for users unfamiliar with Haskell, and so on.</li>

14 </ul>

15 <p>So -- any ideas? Perhaps I really want the <a href="http://www.yesodweb.com/blog/2011/5/introducing%2Dyesod%2Dwiki">system used for the Yesod wiki</a>, but I'm assuming it would not be cheap. The most viable thing I have considered so far is using pandoc to generate docbook, and from there generating chunked HTML. This is nice in some ways but not ideal: pandoc actually can't do syntax highlighting when writing anything other than HTML; I don't know how I would include collapsible sections; and you can only use two heading levels if you want valid literate Haskell.</p>

Generic.hs (https://github.com/khskrede/mehh.git) Haskell · 296 lines

84 tail = List.tail

85

86 -- | Converts a Haskell string into a UTF8 encoded bytestring.

87 {-# SPECIALIZE fromString :: String -> B.ByteString #-}

88 {-# SPECIALIZE fromString :: String -> L.ByteString #-}

91 fromString xs = pack (encode xs)

92

93 -- | Convert a UTF8 encoded bytestring into a Haskell string.

94 -- Invalid characters are replaced with '\xFFFD'.

95 {-# SPECIALIZE toString :: B.ByteString -> String #-}

formated_article.html (https://github.com/graninas/Haskell-Algorithms.git) HTML · 337 lines

16 Çäåñü óêàçàíî, ÷òî <font color=blue>Maybe</font> - ýòî êîíñòðóêòîð òèïà, â êîòîðûé ïîìåùàåòñÿ îïðåäåëåííûé òèï <font color=blue>a</font>, ÷òîáû ïîëó÷èòü (êîíêðåòíûé) òèï äàííûõ. Åùå ãîâîðÿò, ÷òî <font color=blue>Maybe</font> - ýòî "ïîëèìîðôíûé" òèï äàííûõ, ñìûñë òîò æå. Òàê, åñëè áû <font color=blue>a</font> áûë <font color=blue>Int</font>, ìû áû ïîëó÷èëè:

17

18 <blockquote><font color="#06c">data</font>&nbsp;<font color=green><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Maybe">Maybe</a></font>&nbsp;<font color=green><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Int">Int</a></font>&nbsp;<font color="#66cc66"><b>=</b></font>&nbsp;Nothing&nbsp;<font color="#339933">|</font>&nbsp;Just&nbsp;<font color=green><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Int">Int</a></font></blockquote>

19

20 Òîëüêî âîò íàì íå íóæíî ýòî ïèñàòü íåïîñðåäñòâåííî, òàê êàê àáñòðàêòíîå îïðåäåëåíèå âûøå ïîäõîäèò êî âñåì òèïàì.

182 g&nbsp;x&nbsp;<font color="#66cc66"><b>=</b></font>&nbsp;<font color="#06c">if</font>&nbsp;x&nbsp;`<font>mod</font>`&nbsp;<font color=red>3</font>&nbsp;<font color="#339933">==</font>&nbsp;<font color=red>0</font>&nbsp;<font color="#06c">then</font>&nbsp;Nothing&nbsp;<font color="#06c">else</font>&nbsp;Just&nbsp;<font>&#40;</font><font color=red>3</font>&nbsp;<font color="#339933">*</font>&nbsp;x<font>&#41;</font><br/>

183 &nbsp;<br/>

184 h&nbsp;<font color="#66cc66"><b>::</b></font>&nbsp;<font color=green><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Int">Int</a></font>&nbsp;<font color="#339933">-&gt;</font>&nbsp;<font color=green><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Maybe">Maybe</a></font>&nbsp;<font color=green><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Int">Int</a></font><br/>

185 h&nbsp;x&nbsp;<font color="#66cc66"><b>=</b></font>&nbsp;<font color="#06c">if</font>&nbsp;x&nbsp;`<font>mod</font>`&nbsp;<font color=red>5</font>&nbsp;<font color="#339933">==</font>&nbsp;<font color=red>0</font>&nbsp;<font color="#06c">then</font>&nbsp;Nothing&nbsp;<font color="#06c">else</font>&nbsp;Just&nbsp;<font>&#40;</font><font color=red>5</font>&nbsp;<font color="#339933">*</font>&nbsp;x<font>&#41;</font></blockquote>

186

187 Íàì áû õîòåëîñü ñîåäèíèòü èõ â îäíó ôóíêöèþ, êîòîðàÿ åñòü ðåçóëüòàò ïðèìåíåíèÿ ïî ïîðÿäêó <font color=blue>f</font>, <font color=blue>g</font>, <font color=blue>h</font>:

188

189 <blockquote>k&nbsp;<font color="#66cc66"><b>::</b></font>&nbsp;<font color=green><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Int">Int</a></font>&nbsp;<font color="#339933">-&gt;</font>&nbsp;<font color=green><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Maybe">Maybe</a></font>&nbsp;<font color=green><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Int">Int</a></font></blockquote>

190

191 È åñëè êàêàÿ-òî èç òðåõ ôóíêöèé ïîòåðïèò íåóäà÷ó, ôóíêöèÿ <font color=blue>k</font> äîëæíà âåðíóòü <font color=blue>Nothing</font>. Ýòà ôóíêöèÿ óìíîæàåò âõîäíîå ÷èñëî íà 30, åñëè îíî íå äåëèòñÿ öåëî÷èñëåííî íà 2, 3 èëè 5 (à åñëè äåëèòñÿ, ôóíêöèÿ âîçâðàùàåò <font color=blue>Nothing</font>).

CabalReinstall.hs (https://github.com/bgamari/ghc.git) Haskell · 112 lines

11 import Data.Either

12 import Rules.BinaryDist

13 import Hadrian.Haskell.Cabal (pkgIdentifier)

14

15 {-

25 -- | We don't support reinstalling these

26 cabalExcludedPackages :: [Package]

27 cabalExcludedPackages = [array, base, deepseq, filepath, ghcBignum, ghcBootTh, ghcPrim, integerGmp, integerSimple, pretty, templateHaskell]

28

29 findCabalPackageDb :: String -> FilePath

66 -/- "include"

67

68 libdir <- liftIO . IO.makeAbsolute =<< stageLibPath Stage1

69 work_dir <- liftIO $ IO.makeAbsolute $ root -/- "stage-cabal"

70 let outputDir = work_dir -/- "bin"

IOEnv.hs (https://github.com/pepeiborra/ghc.git) Haskell · 216 lines

124 tryAllM :: IOEnv env r -> IOEnv env (Either SomeException r)

125 -- Catch *all* exceptions

126 -- This is used when running a Template-Haskell splice, when

127 -- even a pattern-match failure is a programmer error

128 tryAllM (IOEnv thing) = IOEnv (\ env -> try (thing env))

174 atomicUpdMutVar' var upd = do

175 r <- atomicUpdMutVar var upd

176 _ <- liftIO . evaluate =<< readMutVar var

177 return r

178

initial-data.yml (https://bitbucket.org/nforge/hive.git) YAML · 489 lines

190 - !!models.Label

191 category: Language

192 name: Haskell

193 - !!models.Label

194 category: Language

Tests.hs (https://gitlab.com/alx741/stylish-haskell) Haskell · 468 lines

1 --------------------------------------------------------------------------------

2 module Language.Haskell.Stylish.Step.Imports.Tests

3 ( tests

4 ) where

12

13 --------------------------------------------------------------------------------

14 import Language.Haskell.Stylish.Step.Imports

15 import Language.Haskell.Stylish.Tests.Util

27 --------------------------------------------------------------------------------

28 tests :: Test

29 tests = testGroup "Language.Haskell.Stylish.Step.Imports.Tests"

30 [ testCase "case 01" case01

31 , testCase "case 02" case02

INSTALL.md (https://github.com/pfq/PFQ.git) Markdown · 112 lines

10 1. What is PFQ?

11 2. HW and SW Requirements.

12 3. Haskell and Linux Distributions.

13 4. Obtaining source codes.

14 5. Satisfy library dependencies.

31 * A gcc compiler, the one used to compile the kernel in use.

32 * A g++ compiler (g++-4.8/clang-3.4 or higher), for user-space tools and libraries.

33 * The Haskell stack tool [haskell-stack](https://docs.haskellstack.org/en/stable/README/)

34 * CMake, make, autoconf.

35 * Flex and bison.

40 We recommend you to install the stack Haskell tool following the instructions at [Stackage](http://www.stackage.org/install) site.

41

42 However, if you plan to install the Haskell platform from [Haskell-Platform](https://www.haskell.org/platform/), you may encounter compilation problems if you have a system with PIE (position independent executables) enabled by default (such as Ubuntu, Debian etc.).

43

44 If it is your case, you have to edit the GHC settings file at:

RenameFolderParticipant.java (https://github.com/thiagoarrais/eclipsefp.git) Java · 95 lines

3 * Released under the terms of the EPL.

4 */

5 package net.sf.eclipsefp.haskell.ui.internal.refactoring.participants;

6

7 import java.util.ArrayList;

8 import java.util.Set;

9 import net.sf.eclipsefp.haskell.ui.internal.util.UITexts;

10 import net.sf.eclipsefp.haskell.util.FileUtil;

23

24 /**

25 * Manages the renaming of a Haskell source folder.

26 * @author Alejandro Serrano

27 *

47 if (resource instanceof IFile && FileUtil.hasHaskellExtension( resource )) {

48 haskellFiles.add( (IFile )resource ); // Found a Haskell file

49 }

50 return true;

elm.vim (https://github.com/lshemesh/vim.git) Vim Script · 125 lines

1 " Vim indent file

2 " Language: Haskell

3 " Maintainer: lilydjwg <lilydjwg@gmail.com>

4 " Version: 1.0

5 " References: http://en.wikibooks.org/wiki/Haskell/Indentation

6 " http://book.realworldhaskell.org/read/

13 let b:did_indent = 1

14

15 setlocal indentexpr=HaskellIndent()

16 for i in split('0{,:,0#,e', ',')

17 exec "setlocal indentkeys-=" . i

21 setlocal expandtab

22

23 if !exists('g:Haskell_no_mapping')

24 inoremap <silent> <BS> <C-R>=<SID>HaskellDedent(1)<CR>

Buffer.hs (git://github.com/acowley/CLUtil.git) Haskell · 219 lines

133 -- with an 'VM.IOVector', then apply the given function to that

134 -- buffer. This is typically used to have an OpenCL kernel write

135 -- directly to a Haskell vector. If the OpenCL context can not

136 -- directly use the pointer, this will raise a runtime error!

137 withSharedMVector :: forall a r m. (Storable a, HasCL m)

164 (ev,ptr) <- clEnqueueMapBuffer q mem True flags 0 sz []

165 fp <- newForeignPtr_ $ castPtr ptr

166 x <- evaluate =<< (unsafeSTToIO . f

167 $ VM.unsafeFromForeignPtr0 fp n)

168 clEnqueueUnmapMemObject q mem ptr [ev] >>= waitReleaseEvent

171 -- liftIO $ do (ev, ptr) <- clEnqueueMapBuffer q mem False flags 0 sz []

172 -- let go = do fp <- newForeignPtr_ $ castPtr ptr

173 -- x <- evaluate =<<

174 -- (unsafeSTToIO . f

175 -- $ VM.unsafeFromForeignPtr0 fp n)

Internal.hs (https://github.com/morpheusgraphql/morpheus-graphql.git) Haskell · 373 lines

12 {-# LANGUAGE RecordWildCards #-}

13 {-# LANGUAGE StandaloneDeriving #-}

14 {-# LANGUAGE TemplateHaskell #-}

15 {-# LANGUAGE TypeApplications #-}

16 {-# LANGUAGE TypeFamilies #-}

104 import Data.Semigroup ((<>))

105 import Data.Traversable (traverse)

106 import Language.Haskell.TH (Exp, Q)

107 import Prelude

108 ( ($),

Int.hs (https://github.com/kfish/zoom-cache-pcm.git) Haskell · 500 lines

128 deltaDecodeRaw = deltaDecodePCM

129

130 #if __GLASGOW_HASKELL__ >= 702

131 {-# SPECIALIZE readSummaryPCM :: (Functor m, Monad m) => Iteratee ByteString m (SummaryData (PCM Int)) #-}

132 #endif

175 pcmMkSummaryWork = SummaryWorkPCMInt

176

177 #if __GLASGOW_HASKELL__ >= 702

178 {-# SPECIALIZE fromSummaryPCM :: SummaryData (PCM Int) -> Builder #-}

179 {-# SPECIALIZE initSummaryPCMBounded :: SampleOffset -> SummaryWork (PCM Int) #-}

204 deltaDecodeRaw = deltaDecodePCM

205

206 #if __GLASGOW_HASKELL__ >= 702

207 {-# SPECIALIZE readSummaryPCM :: (Functor m, Monad m) => Iteratee ByteString m (SummaryData (PCM Int8)) #-}

208 #endif

Rooms.hs (https://gitlab.com/gilmi/massage) Haskell · 192 lines

1 {-# LANGUAGE TemplateHaskell, TypeOperators, OverloadedStrings #-}

2

3 {- | Rooms

189 outHandler :: STM.TQueue MsgOut -> STM.TQueue MsgOut -> IO ()

190 outHandler input output = STM.atomically $ do

191 STM.writeTQueue output =<< STM.readTQueue input

192

193

Class.hs (https://github.com/tweag/capability.git) Haskell · 173 lines

42 -- An instance should fulfill the following laws.

43 -- At this point these laws are not definitive,

44 -- see <https://github.com/haskell/mtl/issues/5>.

45 --

46 -- prop> get @t >>= \s1 -> get @t >>= \s2 -> pure (s1, s2) = get @t >>= \s -> pure (s, s)

FileChooserDialog.chs.pp (https://github.com/thiagoarrais/gtk2hs.git) Puppet · 152 lines

1 -- -*-haskell-*-

2 -- GIMP Toolkit (GTK) Widget FileChooserDialog

3 --

123

124 -- Annoyingly, the constructor for FileChooserDialog uses varargs so we can't

125 -- call it using the Haskell FFI. The GTK people do not consider this an api

126 -- bug, see <http://bugzilla.gnome.org/show_bug.cgi?id=141004>

127 -- The solution is to call objectNew and add the buttons manually.

build-prog.mk (https://github.com/pepeiborra/ghc.git) Makefile · 193 lines

6 #

7 # To understand how the build system works and how to modify it, see

8 # http://hackage.haskell.org/trac/ghc/wiki/Building/Architecture

9 # http://hackage.haskell.org/trac/ghc/wiki/Building/Modifying

README.md (https://github.com/killerswan/reactive-banana.git) Markdown · 71 lines

5 <div style="float:left;"><img src="https://github.com/HeinrichApfelmus/reactive-banana/raw/master/banana.png" /></div>

6

7 Reactive-banana is a library for [Functional Reactive Programming (FRP)][frp], written in Haskell.

8

9 See the **[project homepage][homepage]** for **documentation**, **examples** and so on.

10

11 [homepage]: http://wiki.haskell.org/Reactive-banana

12 [frp]: http://wiki.haskell.org/Functional_Reactive_Programming

26 cabal install wx

27

28 Note that you need to have a development version of the wxWidgets libraries installed before building wx. If you run into `ExitFailure 1` exceptions, please follow the [wxHaskell Quick Start](http://wiki.haskell.org/WxHaskell/Building) instructions and try again.

29

30 To build the wx examples, type

41 * `reactive-banana-wx` — bindings to the [wxHaskell][] GUI library, includes many examples

42

43 [wxhaskell]: http://wiki.haskell.org/WxHaskell

44 [threepenny-gui]: http://wiki.haskell.org/Threepenny-gui

Word.hs (https://github.com/kfish/zoom-cache.git) Haskell · 570 lines

145 )where

146

147 #if __GLASGOW_HASKELL__ >= 702

148 import Data.ByteString (ByteString)

149 import Data.Iteratee (Iteratee)

180 prettySummaryData = prettySummaryWord

181

182 #if __GLASGOW_HASKELL__ >= 702

183 {-# SPECIALIZE readSummaryNum :: (Functor m, Monad m) => Iteratee ByteString m (SummaryData Word) #-}

184 #endif

231 numMkSummaryWork = SummaryWorkWord

232

233 #if __GLASGOW_HASKELL__ >= 702

234 {-# SPECIALIZE fromSummaryNum :: SummaryData Word -> Builder #-}

235 {-# SPECIALIZE initSummaryNumBounded :: SampleOffset -> SummaryWork Word #-}

Int.hs (https://github.com/kfish/zoom-cache.git) Haskell · 725 lines

174 )where

175

176 #if __GLASGOW_HASKELL__ >= 702

177 import Data.ByteString (ByteString)

178 import Data.Iteratee (Iteratee)

212 deltaDecodeRaw = deltaDecodeNum

213

214 #if __GLASGOW_HASKELL__ >= 702

215 {-# SPECIALIZE readSummaryNum :: (Functor m, Monad m) => Iteratee ByteString m (SummaryData Int) #-}

216 #endif

264 numMkSummaryWork = SummaryWorkInt

265

266 #if __GLASGOW_HASKELL__ >= 702

267 {-# SPECIALIZE fromSummaryNum :: SummaryData Int -> Builder #-}

268 {-# SPECIALIZE initSummaryNumBounded :: SampleOffset -> SummaryWork Int #-}

Dispatch.hs (https://github.com/maxcan/yesod.git) Haskell · 190 lines

1 {-# LANGUAGE TemplateHaskell #-}

2 {-# LANGUAGE CPP #-}

3 {-# LANGUAGE OverloadedStrings #-}

31

32 import Web.PathPieces

33 import Language.Haskell.TH.Syntax

34

35 import qualified Network.Wai as W

HOE.hs (https://github.com/Phlogistique/hoe.git) Haskell · 134 lines

8 import System.IO

9

10 import Language.Haskell.Interpreter as HInt hiding (name)

11

12 data Option

32 &= name "m" }

33 &= program "hoe"

34 &= summary "Haskell One-liner Evaluator, (c) Hideyuki Tanaka 2010"

35

36 main :: IO ()

104 evalStr s _ = do

105 r <- interpret s (as :: IO String)

106 liftIO $ putStrLn =<< r

107 evalStrI s intr = do

108 r <- interpret s (as :: String -> String)

OpenAL.hs (https://github.com/dancor/YampaSynth.git) Haskell · 183 lines

101 instance (Storable a, Bits a, Audible a) => Chunkable a -- thx copumpkin @ #haskell

102

103 -- from http://www.haskell.org/pipermail/beginners/2009-January/000690.html (via byorgey @ #haskell)

104 untilM :: (Monad m) => (a -> Bool) -> (a -> m a) -> a -> m a

105 untilM p f x | p x = return x

128 else do let h = head freeBuffers

129 return (h, tail freeBuffers, usedBuffers ++ [h])

130 ((bufferData buff) $=) =<< createBufferData sampleRate' chunk ind

131 _ <- reply Nothing undefined

132 queueBuffers pSource [buff]

TH.hs (git://github.com/mgsloan/newtype-th.git) Haskell · 151 lines

1 {-# LANGUAGE TemplateHaskell, TupleSections #-}

2 -----------------------------------------------------------------------------

3 -- |

8 -- Portability : unportable

9 --

10 -- This module provides a template Haskell based mechanism for deriving

11 -- instances of the @Newtype@ class, defined in @ Control.Newtype @ in the

12 -- newtype package. Example usage:

40 import Data.Generics.Aliases ( extT, extQ )

41

42 import Language.Haskell.TH

43 import Language.Haskell.Meta.Utils (conName, conTypes)

50 -- to newtypes.

51 mkNewtypes :: [Name] -> Q [Dec]

52 mkNewtypes = mapM (\n -> rewriteFamilies =<< mkInst <$> reify n)

53 where

54 mkInst (TyConI (NewtypeD a b c d _)) = mkInstFor a b c d

Util.java (https://github.com/thiagoarrais/eclipsefp.git) Java · 469 lines

3 * Released under the terms of the EPL.

4 */

5 package net.sf.eclipsefp.haskell.ui.internal.refactoring.participants;

6

7 import java.util.ArrayList;

9 import java.util.List;

10 import java.util.Set;

11 import net.sf.eclipsefp.haskell.core.cabalmodel.CabalSyntax;

12 import net.sf.eclipsefp.haskell.core.cabalmodel.PackageDescription;

13 import net.sf.eclipsefp.haskell.core.cabalmodel.PackageDescriptionLoader;

14 import net.sf.eclipsefp.haskell.core.cabalmodel.PackageDescriptionStanza;

15 import net.sf.eclipsefp.haskell.core.cabalmodel.RealValuePosition;

16 import net.sf.eclipsefp.haskell.scion.client.ScionInstance;

Widget.hs (https://github.com/PeterScott/yesod.git) Haskell · 267 lines

2 {-# LANGUAGE FlexibleInstances #-}

3 {-# LANGUAGE TypeFamilies #-}

4 {-# LANGUAGE TemplateHaskell #-}

5 {-# LANGUAGE MultiParamTypeClasses #-}

6 -- | Widgets combine HTML with JS and CSS dependencies with a unique identifier

71 import Data.Text (Text)

72 import qualified Data.Map as Map

73 import Language.Haskell.TH.Quote (QuasiQuoter)

74 import Language.Haskell.TH.Syntax (Q, Exp (InfixE, VarE, LamE), Pat (VarP), newName)

ReaderOptions.hs (https://github.com/jgm/pandoc.git) Haskell · 137 lines

44 idx

45 TypeTable -> peekReaderOptionsTable idx

46 _ -> failPeek =<<

47 typeMismatchMessage "ReaderOptions userdata or table" idx

48

61 ### liftPure show

62 <#> udparam typeReaderOptions "opts" "options to print in native format"

63 =#> functionResult pushString "string" "Haskell representation"

64 , operation Newindex $ lambda

65 ### (failLua "This ReaderOptions value is read-only.")

74 ### liftPure show

75 <#> udparam typeReaderOptions "opts" "options to print in native format"

76 =#> functionResult pushString "string" "Haskell representation"

77 ]

78 readerOptionsMembers

Word.hs (https://github.com/tibbe/ghc.git) Haskell · 798 lines

9 -- License : see libraries/base/LICENSE

10 --

11 -- Maintainer : cvs-ghc@haskell.org

12 -- Stability : internal

13 -- Portability : non-portable (GHC Extensions)

Parser.hs (https://github.com/JPMoresmau/scion-class-browser.git) Haskell · 174 lines

7 import Database.Persist

8 import Database.Persist.Sql

9 import Language.Haskell.Exts.Annotated.Syntax

10 import Scion.PersistentBrowser.DbTypes

11 import Scion.PersistentBrowser.Parser.Internal

FourOhFour.hs (https://gitlab.com/platonic/shpadoinkle) Haskell · 175 lines

10 {-# LANGUAGE PatternSynonyms #-}

11 {-# LANGUAGE ScopedTypeVariables #-}

12 {-# LANGUAGE TemplateHaskell #-}

13 {-# LANGUAGE TupleSections #-}

14 {-# OPTIONS_GHC -fno-warn-type-defaults #-}

150 animate win model = newRequestAnimationFrameCallback $ \d -> () <$ do

151 liftIO . atomically . modifyTVar model . tick $ Clock d

152 requestAnimationFrame win =<< animate win model

153

154

157 let gameId = "game"

158 doc <- currentDocumentUnchecked

159 isSubsequent <- traverse toJSVal =<< getElementById doc gameId

160 case isSubsequent of

161 Just raw -> return $ RawNode raw

Diff.hs (https://github.com/huiqing/HaRe.git) Haskell · 423 lines

5 -- License : BSD-style (see the file libraries/base/LICENSE)

6 --

7 -- Maintainer : libraries@haskell.org

8 -- Stability : experimental

9 -- Portability : non-portable (uses Data.Array.IArray)

Rebuild.hs (https://github.com/purerl/purescript.git) Haskell · 199 lines

1 {-# LANGUAGE PackageImports #-}

2 {-# LANGUAGE TemplateHaskell #-}

3

4 module Language.PureScript.Ide.Rebuild

59 -- Externs files must be sorted ahead of time, so that they get applied

60 -- in the right order (bottom up) to the 'Environment'.

61 externs <- logPerf (labelTimespec "Sorting externs") (sortExterns m =<< getExternFiles)

62

63 outputDirectory <- confOutputPath . ideConfiguration <$> ask

AcidStateBackend.hs (https://bitbucket.org/eric_jones_/potion-soap-server.git) Haskell · 274 lines

5 {-# LANGUAGE OverloadedStrings #-}

6 {-# LANGUAGE StandaloneDeriving #-}

7 {-# LANGUAGE TemplateHaskell #-}

8 {-# OPTIONS_GHC -fno-warn-orphans #-}

9

188 H.delete . userLogin <$> storedUser <*> pure li

189 ti' = fromMaybe ti $

190 H.delete <$> (userRememberToken =<< storedUser) <*> pure ti

191 put $ UserStore (H.delete uid us) li' ti' n

192

Common.hs (https://github.com/sarang25491/lex-pass.git) Haskell · 123 lines

1 {-# LANGUAGE DeriveDataTypeable, TemplateHaskell, TypeSynonymInstances,

2 FlexibleInstances, FlexibleContexts, OverlappingInstances,

3 UndecidableInstances #-}

50 -- and i can't believe php works this way with // vs ?>

51 when gotChars $ do

52 setInput =<< ("?>" ++) <$> getInput

53 pos <- getPosition

54 setPosition . setSourceColumn pos $ sourceColumn pos - 2

Propositions.hs (https://github.com/nomeata/incredible.git) Haskell · 205 lines

1 {-# LANGUAGE TemplateHaskell, FlexibleInstances, MultiParamTypeClasses, FlexibleContexts, UndecidableInstances #-}

2 {-# LANGUAGE TypeFamilies #-} -- for the ~ type signature trick

3 module Propositions (module Propositions, string2Name) where

Foldable.hs (https://github.com/khskrede/mehh.git) Haskell · 317 lines

5 -- License : BSD-style (see the LICENSE file in the distribution)

6 --

7 -- Maintainer : libraries@haskell.org

8 -- Stability : experimental

9 -- Portability : portable

69 #endif

70

71 #ifdef __GLASGOW_HASKELL__

72 import GHC.Exts (build)

73 #endif

74

75 #if defined(__GLASGOW_HASKELL__)

76 import GHC.Arr

77 #elif defined(__HUGS__)

Heist.hs (https://github.com/roman/noomii-crawler.git) Haskell · 190 lines

7 The Heist template system is based on HTML and XML. It allows you to build

8 custom HTML and XML based markup languages. With Heist you can define your

9 own domain-specific HTML and XML tags implemented with Haskell and use them

10 in your templates.

11

CCS.h (git://github.com/valderman/haste-compiler.git) C Header · 254 lines

8 *

9 * To understand the structure of the RTS headers, see the wiki:

10 * http://ghc.haskell.org/trac/ghc/wiki/Commentary/SourceTree/Includes

11 *

12 * ---------------------------------------------------------------------------*/

77 /* -----------------------------------------------------------------------------

78 * Start and stop the profiling timer. These can be called from

79 * Haskell to restrict the profile to portion(s) of the execution.

80 * See the module GHC.Profiling.

81 * ---------------------------------------------------------------------------*/

faust.py (https://github.com/kaoskorobase/skUG.git) Python · 127 lines

100 multi = True)

101 hs = SCons.Builder.Builder(

102 action = '$FAUST2SC --lang=haskell --prefix="${FAUST2SC_HASKELL_MODULE}" -o $TARGET $SOURCES',

103 suffix = '.hs',

104 src_suffix = '.dsp.xml',

109 'FaustSVG' : svg,

110 'FaustSC' : sc,

111 'FaustHaskell' : hs })

112

113 env['FAUST_ARCHITECTURE'] = 'module'

116 env['FAUST2SC'] = 'faust2sc'

117 env['FAUST2SC_PREFIX'] = ''

118 env['FAUST2SC_HASKELL_MODULE'] = ''

119

120 env.Append(SCANNERS = [

base.cabal (https://github.com/ghc/packages-Cabal.git) Cabal · 160 lines

3 license: BSD3

4 license-file: LICENSE

5 maintainer: libraries@haskell.org

6 bug-reports: http://hackage.haskell.org/trac/ghc/newticket?component=libraries/base

16 source-repository head

17 type: darcs

18 location: http://darcs.haskell.org/packages/base3-compat

19

20 Library {

TH.hs (https://github.com/tanakh/Peggy.git) Haskell · 311 lines

1 {-# LANGUAGE TemplateHaskell, TupleSections, FlexibleContexts #-}

2

3 module Text.Peggy.CodeGen.TH (

13 import Data.Maybe

14 import Data.Typeable ()

15 import Language.Haskell.Meta

16 import Language.Haskell.TH

17 import Language.Haskell.TH.Syntax

18 import Language.Haskell.TH.Quote

213 let gcf = genCF isE (ccf vn)

214 doE $ map return bs ++

215 [ noBindS [| return $ foldl appE (return $(lift =<< gcf)) $(eQnames vn) |]]

216 where

217 ccf 0 = cf

Leibniz.hs (https://github.com/jvranish/Leibniz.git) Haskell · 89 lines

9

10 -- http://en.wikipedia.org/wiki/Gottfried_Leibniz#Information_technology

11 -- http://notvincenz.blogspot.com/2008/01/simple-type-inference-in-haskell.html

12

13 import LeibnizExpr

40 matchEquation :: Closure -> [ParsedExpr] -> Equation ParsedExpr -> Maybe ParsedExpr

41 matchEquation closure stack (Equation patterns expr) = let evalRightSide newClosure = evaluateExpr (union newClosure closure) (drop (length patterns) stack) expr in

42 either Just (Just . evalRightSide . fromList =<<) (collectMatches $ zipWith (match []) patterns stack)

43

44 collectMatches :: (Error a) => [Either a (Maybe [b])] -> Either a (Maybe [b])

Core.hs (https://github.com/yogsototh/yesod.git) Haskell · 223 lines

197 case conflict of

198 Just unique ->

199 badRequest' $ map (unHaskellName . fst) $ persistUniqueToFieldNames unique

200 Nothing -> insert datum

201

IOExts.hs (git://pkgs.fedoraproject.org/hugs98) Haskell · 198 lines

41

42 {- unsafePtrEq -- :: a -> a -> Bool

43 freeHaskellFunctionPtr

44

45 extended IOError predicates

release.hs (https://github.com/GunioRobot/control-monad-exception.git) Haskell · 150 lines

1 #!/usr/bin/env runHaskell

2

3 {-# LANGUAGE ScopedTypeVariables #-}

83 saveCurrentCabalFiles = do

84 currentDescriptors <- filter (\x -> takeExtension x ==".cabal")

85 <$> (getDirectoryContents =<< getCurrentDirectory)

86 currentDescriptorsTmp <- mapM cpTemp currentDescriptors

87 return (mapM stripExtension currentDescriptorsTmp)

90 cabal_test d = do

91 _ <- cmd "cabal clean -v0"

92 guardOk (d ++ " failed to build correctly") =<< cmd "cabal install -v0"

93 guardOk (d ++ " failed to test correctly") =<< cmd "cabal test"

95 -- | package and store for release.

96 cabal_dist d = when (isRelease action) $ do

97 guardOk (d ++ " failed to package correctly") =<< cmd ("cabal sdist --builddir=" ++ releaseDir)

98

99 -- | Returns an action to upload a package already stored in the release dir to Hackage

Panic.hs (https://github.com/bgamari/ghc.git) Haskell · 103 lines

34 * A consequence of defining them in ghc-prim is that the libraries

35 defining exceptions have not yet been built, so we can't make them

36 into proper Haskell exceptions.

37

38 However, if these functions are ever called, it's a /compiler/ error,

GenLib.hs (https://github.com/jtdaugherty/vty-ui-builder.git) Haskell · 231 lines

30 import qualified Graphics.Vty.Widgets.Builder.AST as A

31 import qualified Graphics.Vty.Widgets.Builder.SrcHelpers as S

32 import qualified Language.Haskell.Exts as Hs

33

34 generateWidgetSource :: WidgetElementHandler

ColorProvider.java (https://github.com/serras/eclipsefp.git) Java · 156 lines

2 // This code is made available under the terms of the Eclipse Public License,

3 // version 1.0 (EPL). See http://www.eclipse.org/legal/epl-v10.html

4 package net.sf.eclipsefp.haskell.ui.internal.editors.haskell.text;

5

6 import java.util.HashMap;

7 import java.util.Iterator;

8 import java.util.Map;

9 import net.sf.eclipsefp.haskell.ui.HaskellUIPlugin;

10 import net.sf.eclipsefp.haskell.ui.internal.preferences.editor.IEditorPreferenceNames;

152 return prefStore;

153 }

154 return HaskellUIPlugin.getDefault().getPreferenceStore();

155 }

156 }

doc-index.html (https://github.com/rosco/snap-website.git) HTML · 768 lines

1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

2 <!--Rendered using the Haskell Html Library v0.2-->

3 <HTML

4 ><HEAD

17 ><TR

18 ><TD

19 ><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "

20 ></TD

21 ><TD CLASS="title"

default-layout.cassius (git://github.com/snoyberg/haskellers.git) Cassius · 290 lines ✨ Summary

This CSS code defines a set of styles for various HTML elements, including tables, forms, and navigation components. It sets colors, fonts, and layouts for these elements, creating a consistent visual design throughout a website. The code also targets specific browser features, such as the :hover pseudo-class and the :visited pseudo-class, to enhance user interactions.

31 font-size: 20px

32 margin: 15px 0 5px 0

33 #haskell_bar

34 font-size: 13px

35 background: #293845

94 color: #FFDBDB

95 height: 55px

96 body.find-haskeller #main_menu a#find_haskeller

97 background-position: -120px -1px

98 #secondary_menu

283 margin-right: 10px

284

285 #haskell_bar form, #haskell_bar p

286 display: inline

287

Stack.hs (https://github.com/jberthold/ghc.git) Haskell · 104 lines

7 -- License : see libraries/base/LICENSE

8 --

9 -- Maintainer : cvs-ghc@haskell.org

10 -- Stability : internal

11 -- Portability : non-portable (GHC Extensions)

62 errorWithStackTrace :: String -> a

63 errorWithStackTrace x = unsafeDupablePerformIO $ do

64 stack <- ccsToStrings =<< getCurrentCCS x

65 if null stack

66 then throwIO (ErrorCall x)

README.md (https://bitbucket.org/dividuum/rocket-scissor-spacegoo.git) Markdown · 120 lines

115 ----------------

116

117 Haskell-Programmierer können das Haskell-Paket

118 [`haskell-spacegoo`](https://bitbucket.org/nomeata/haskell-spacegoo) verwenden,

Yesod.hs (https://github.com/wavewave/model-server.git) Haskell · 143 lines

1 {-# LANGUAGE TemplateHaskell, QuasiQuotes, DeriveDataTypeable,

2 MultiParamTypeClasses, TypeFamilies, FlexibleContexts,

3 FlexibleInstances, OverloadedStrings #-}

53 getListModelR = do

54 liftIO $ putStrLn "getQueueListR called"

55 acid <- return.server_acid =<< getYesod

56 r <- liftIO $ query acid QueryAll

57 liftIO $ putStrLn $ show r

62 postUploadModelR = do

63 liftIO $ putStrLn "postQueueR called"

64 acid <- return.server_acid =<< getYesod

65 _ <- getRequest

66 bs' <- lift EL.consume

89 handleModelR :: UUID -> Handler RepHtmlJson

90 handleModelR name = do

91 wr <- return.reqWaiRequest =<< getRequest

92 case requestMethod wr of

93 "GET" -> getModelR name

Main.hs (https://github.com/kowey/ThreadScope.git) Haskell · 360 lines

1 {-# LANGUAGE CPP #-}

2 -- ThreadScope: a graphical viewer for Haskell event log information.

3 -- Maintainer: satnams@microsoft.com, s.singh@ieee.org

4

9 import System.Glib.GError (failOnGError)

10

11 -- Imports from Haskell library

12 import Text.Printf

13 import Control.Monad

109

110 builder <- builderNew

111 builderAddFromFile builder =<< getDataFileName "threadscope.ui"

112

113 eventQueue <- Chan.newChan

302 dispatch EventBookmarkAdd EventlogLoaded{cursorTs} = do

303 bookmarkViewAdd bookmarkView cursorTs

304 timelineWindowSetBookmarks timelineWin =<< bookmarkViewGet bookmarkView

305 continue

306

HaskellGhcParser.hs (https://github.com/RefactoringTools/HaRe.git) Haskell · 294 lines

1 {-# LANGUAGE ScopedTypeVariables #-}

2 module HaskellGhcParser where

3

4 -- container

42 import Language.Haskell.Exts.Parser (ParseResult(ParseOk))

43 import Language.Haskell.Exts.Syntax (Module)

44 import Data.List

45

46 haskellghc = Parser "Haskell" [".hs"] buildTreeHaskellGhc

47

48 buildTreeHaskellGhc :: String -> Tree String

49 buildTreeHaskellGhc s = case parseHaskellGhc s of

50 Right ast -> flat $ data2treeGhc (ast::GHC.Located (GHC.HsModule GHC.RdrName))

51 -- Right ast -> flat $ data2tree (ast::GHC.Located (GHC.HsModule GHC.RdrName))

CCS.h (https://github.com/bgamari/ghc.git) C Header · 227 lines

8 *

9 * To understand the structure of the RTS headers, see the wiki:

10 * https://gitlab.haskell.org/ghc/ghc/wikis/commentary/source-tree/includes

11 *

12 * ---------------------------------------------------------------------------*/

77 /* -----------------------------------------------------------------------------

78 * Start and stop the profiling timer. These can be called from

79 * Haskell to restrict the profile to portion(s) of the execution.

80 * See the module GHC.Profiling.

81 * ---------------------------------------------------------------------------*/