100+ results for 'import UniqFM lang:Haskell'

Not the results you expected?

Stats.hs (https://bitbucket.org/carter/ghc.git) Haskell · 297 lines

18 #include "nativeGen/NCG.h"

19

20 import qualified GraphColor as Color

21 import RegAlloc.Liveness

23 import RegAlloc.Graph.SpillCost

24 import RegAlloc.Graph.TrivColorable

25 import Instruction

32 import Outputable

33 import UniqFM

34 import UniqSet

195 $$ text "\n")

196

197 binLifetimeCount :: UniqFM (VirtualReg, Int) -> UniqFM (Int, Int)

198 binLifetimeCount fm

199 = let lifes = map (\l -> (l, (l, 1)))

Pretty.hs (https://github.com/mchakravarty/packages-dph.git) Haskell · 259 lines

5 , pprTopBinds)

6 where

7 import DPH.Base.Pretty

8 import HscTypes

9 import Avail

10 import CoreSyn

11 import Type

12 import Coercion

13 import Var

14 import Name

19 import Unique

20 import qualified UniqFM as UFM

21

22 -- Guts -----------------------------------------------------------------------

CgExtCode.hs (https://github.com/pepeiborra/ghc.git) Haskell · 229 lines

21 newLabel,

22 newFunctionName,

23 newImport,

24 lookupLabel,

25 lookupName,

42 import OldCmm hiding( ClosureTypeInfo(..) )

43

44 -- import BasicTypes

45 import BlockId

47 import Module

48 import UniqFM

49 import Unique

59

60 -- | An environment of named things.

61 type Env = UniqFM Named

62

63 -- | Local declarations that are in scope during code generation.

Set.hs (https://github.com/bgamari/ghc.git) Haskell · 198 lines

5 \section[UniqSet]{Specialised sets, for things with @Uniques@}

6

7 Based on @UniqFMs@ (as you would expect).

8

9 Basically, the things need to be in class @Uniquable@.

14 module GHC.Types.Unique.Set (

15 -- * Unique set type

16 UniqSet, -- type synonym for UniqFM a

17 getUniqSet,

18 pprUniqSet,

47 ) where

48

49 import GHC.Prelude

50

51 import GHC.Types.Unique.DFM

Spill.hs (https://github.com/mzero/ghc.git) Haskell · 338 lines

13 import Reg

14 import OldCmm hiding (RegSet)

15 import BlockId

16

17 import State

18 import Unique

19 import UniqFM

20 import UniqSet

21 import UniqSupply

22 import Outputable

24 import Data.List

25 import Data.Maybe

26 import Data.Map (Map)

Coalesce.hs (https://github.com/pepeiborra/ghc.git) Haskell · 88 lines

9 where

10

11 import RegAlloc.Liveness

12 import Instruction

13 import Reg

14

15 import OldCmm

17 import Digraph

18 import UniqFM

19 import UniqSet

44

45

46 buildAlloc :: UniqFM Reg -> (Reg, Reg) -> UniqFM Reg

47 buildAlloc fm (r1, r2)

48 = let rmin = min r1 r2

Classify.hs (https://github.com/pepeiborra/ghc.git) Haskell · 103 lines

20 import UniqSet

21 import UniqFM

22 import DataCon

23 import TyCon

24 import TypeRep

25 import Type

26 import Digraph

37 -- * tycons which can't be converted are not elements of the map

38 --

39 classifyTyCons :: UniqFM Bool -- ^type constructor conversion status

40 -> [TyCon] -- ^type constructors that need to be classified

41 -> ([TyCon], [TyCon]) -- ^tycons to be converted & not to be converted

StgAst.hs (https://bitbucket.org/bathtub/ghcjs.git) Haskell · 103 lines

13 import CoreSyn

14 import CostCentre

15 import DataCon

16 import DynFlags

17 import ForeignCall

18 import Id

19 import Literal

21 import Outputable hiding ((<>))

22 import PrimOp

23 import StgSyn

24 import Type

25 import UniqFM

26 import UniqSet

Env.hs (https://github.com/ghc/ghc.git) Haskell · 276 lines

36 where

37

38 import GHC.Prelude

39

40 import GHC.Unit.Module.Name (ModuleName)

41 import GHC.Types.Unique

42 import GHC.Types.Unique.FM

43 import GHC.Types.Unique.DFM

44 import GHC.Unit.Types

45 import GHC.Utils.Misc

46 import Data.List (sortBy, sort)

47 import Data.Ord

48

49 import Data.Coerce

RegInfo.hs (https://github.com/tibbe/ghc.git) Haskell · 75 lines

17 #include "HsVersions.h"

18

19 import Size

20 import Reg

21

22 import Outputable

23 import Platform

24 import Unique

25

26 import UniqFM

27 import X86.Regs

41 in text str

42

43 regColors :: Platform -> UniqFM [Char]

44 regColors platform = listToUFM (normalRegColors platform ++ fpRegColors)

45

Reg.hs (https://github.com/pepeiborra/ghc.git) Haskell · 220 lines

28 where

29

30 import Outputable

31 import Unique

32 import RegClass

33 import Data.List

165

166

167 -- We like to have Uniques for Reg so that we can make UniqFM and UniqSets

168 -- in the register allocator.

169 instance Uniquable Reg where

Set.hs (https://github.com/ghc/ghc.git) Haskell · 360 lines

47 ) where

48

49 import GHC.Prelude

50

51 import GHC.Types.Var ( Var, TyVar, CoVar, TyCoVar, Id )

52 import GHC.Types.Unique

53 import GHC.Types.Name ( Name )

54 import GHC.Types.Unique.Set

55 import GHC.Types.Unique.DSet

56 import GHC.Types.Unique.FM( disjointUFM, pluralUFM, pprUFM )

57 import GHC.Types.Unique.DFM( disjointUDFM, udfmToUfm, anyUDFM, allUDFM )

58 import GHC.Utils.Outputable (SDoc)

59

60 -- | A non-deterministic Variable Set

coredump.hs (https://github.com/khskrede/mehh.git) Haskell · 99 lines

1

2

3 import GHC

4 --GHC.Paths is available via cabal install ghc-paths

5 import GHC.Paths ( libdir )

7 import DynFlags ( defaultDynFlags )

8 import System.Environment ( getArgs )

9 import Outputable

10

11 import Text.JSON

12 import Text.JSON.Pretty

14 import Text.PrettyPrint.HughesPJ

15

16 import UniqFM

17 import Unique

Plugins.hs (https://github.com/bgamari/ghc.git) Haskell · 187 lines

4 -- the functions and types you are likely to need when writing a

5 -- plugin for GHC. So authors of plugins can probably get away simply

6 -- with saying "import GHC.Plugins".

7 --

8 -- Particularly interesting modules for plugin writers include

68

69 -- Plugin stuff itself

70 import GHC.Driver.Plugins

71

72 -- Variable naming

73 import GHC.Types.TyThing

74 import GHC.Types.PkgQual

122 -- Conflicts with UniqFM:

123 --import LazyUniqFM

124 import GHC.Data.FiniteMap

GhcPlugins.hs (https://github.com/pepeiborra/ghc.git) Haskell · 83 lines

29 import RdrName

30 import OccName hiding ( varName {- conflicts with Var.varName -} )

31 import Name hiding ( varName {- reexport from OccName, conflicts with Var.varName -} )

38 import Literal

39 import DataCon

40 import CoreUtils

57 import Coercion hiding {- conflict with CoreSubst -}

58 ( substTy, extendTvSubst, substCo, substTyVarBndr, lookupTyVar )

59 import TyCon

60 import TysWiredIn

69 import UniqSet

70 import UniqFM

71 -- Conflicts with UniqFM:

72 --import LazyUniqFM

73 import FiniteMap

Base.hs (git://github.com/ilyasergey/GHC-XAppFix.git) Haskell · 242 lines

26 #include "HsVersions.h"

27

28 import Llvm

29 import LlvmCodeGen.Regs

30

31 import CLabel

32 import CgUtils ( activeStgRegs )

33 import Config

34 import Constants

35 import FastString

36 import OldCmm

38 import Platform

39 import UniqFM

40 import Unique

Base.hs (https://github.com/jberthold/ghc.git) Haskell · 134 lines

18 where

19

20 import GhcPrelude

21

22 import RegAlloc.Linear.StackMap

23 import RegAlloc.Liveness

24 import Reg

25

26 import DynFlags

27 import Outputable

28 import Unique

29 import UniqFM

30 import UniqSupply

Common.hs (https://github.com/ghc/ghc.git) Haskell · 118 lines

10

11 -- ghc

12 import GHC.Core.Class

13 ( Class )

14 import GHC.Core.DataCon

15 ( promoteDataCon )

16 import GHC.Core.TyCon

17 ( TyCon )

18 import GHC.Core.Type

20 , mkTyConApp

21 )

22 import GHC.Plugins

23 ( Plugin(..)

24 , defaultPlugin, purePlugin

Env.hs (https://github.com/dmpots/ghc.git) Haskell · 191 lines

9 import Vectorise.Monad

10 import Vectorise.Builtins

11 import Vectorise.Type.TyConDecl

12 import Vectorise.Type.Classify

13 import Vectorise.Type.PADict

14 import Vectorise.Type.PData

15 import Vectorise.Type.PRepr

23 import DataCon

24 import TyCon

25 import Type

33 import Unique

34 import UniqFM

35 import Util

RewritePerfPlugin.hs (https://github.com/bgamari/ghc.git) Haskell · 97 lines

5

6 -- ghc

7 import GHC.Core

8 ( Expr(Coercion) )

9 import GHC.Core.Coercion

10 ( mkUnivCo )

11 import GHC.Core.TyCo.Rep

12 ( Type, UnivCoProvenance(PluginProv) )

13 import GHC.Core.TyCon

14 ( TyCon )

15 import GHC.Core.Type

16 ( eqType, mkTyConApp, splitTyConApp_maybe )

17 import GHC.Plugins

Coalesce.hs (https://github.com/bgamari/ghc.git) Haskell · 99 lines

4 slurpJoinMovs

5 ) where

6 import GHC.Prelude

7

8 import GHC.CmmToAsm.Reg.Liveness

9 import GHC.CmmToAsm.Instr

10 import GHC.Platform.Reg

11

12 import GHC.Cmm

13 import GHC.Data.Bag

45 -- The register with the lowest lexical name is set as the

46 -- canonical version.

47 buildAlloc :: UniqFM Reg Reg -> (Reg, Reg) -> UniqFM Reg Reg

48 buildAlloc fm (r1, r2)

49 = let rmin = min r1 r2

Base.hs (https://github.com/scpmw/ghc.git) Haskell · 132 lines

18 where

19

20 import RegAlloc.Linear.StackMap

21 import RegAlloc.Liveness

22 import Reg

23

24 import DynFlags

25 import Outputable

26 import Unique

27 import UniqFM

28 import UniqSupply

97 data RegAllocStats

98 = RegAllocStats

99 { ra_spillInstrs :: UniqFM [Int] }

100

101

Regs.hs (https://github.com/nominolo/ghc.git) Haskell · 323 lines

24 #include "../includes/stg/MachRegs.h"

25

26 import RegsBase

27

28 import BlockId

29 import Cmm

30 import CLabel ( CLabel, mkMainCapabilityLabel )

31 import Pretty

32 import Outputable ( Outputable(..), pprPanic, panic )

33 import qualified Outputable

34 import Unique

38 import FastBool

39 import UniqFM

40

41

FV.hs (https://github.com/bgamari/ghc.git) Haskell · 199 lines

26 ) where

27

28 import GHC.Prelude

29

30 import GHC.Types.Var

31 import GHC.Types.Var.Set

32

33 -- | Predicate on possible free variables: returns @True@ iff the variable is

38 -- ~~~~~~~~~~~~~~~~~~~~~~~

39 -- When computing free variables, the order in which you get them affects

40 -- the results of floating and specialization. If you use UniqFM to collect

41 -- them and then turn that into a list, you get them in nondeterministic

42 -- order as described in Note [Deterministic UniqFM] in GHC.Types.Unique.DFM.

43

44 -- A naive algorithm for free variables relies on merging sets of variables.

45 -- Merging costs O(n+m) for UniqFM and for UniqDFM there's an additional log

46 -- factor. It's cheaper to incrementally add to a list and use a set to check

47 -- for duplicates.

Set.hs (https://github.com/bgamari/ghc.git) Haskell · 224 lines

36 ) where

37

38 import GHC.Prelude

39

40 import GHC.Types.Name

41 import GHC.Data.OrdList

42 import GHC.Types.Unique.Set

43 import Data.List (sortBy)

44

45 {-

100 -- This only works for Names that originate in the source code or have been

101 -- tidied.

102 -- See Note [Deterministic UniqFM] to learn about nondeterminism

103 nameSetElemsStable :: NameSet -> [Name]

104 nameSetElemsStable ns =

UnVarGraph.hs (https://github.com/typelead/eta.git) Haskell · 136 lines

28 ) where

29

30 import Eta.BasicTypes.Id

31 import Eta.BasicTypes.VarEnv

32 import Eta.Utils.UniqFM

33 import Eta.Utils.Outputable

34 import Data.List

35 import Eta.Utils.Bag

36 import Eta.BasicTypes.Unique

37

38 import qualified Data.IntSet as S

SpillCost.hs (https://github.com/pepeiborra/ghc.git) Haskell · 278 lines

19 import RegAlloc.Liveness

20 import Instruction

21 import RegClass

22 import Reg

23

24 import GraphBase

25

26 import BlockId

27 import OldCmm

28 import UniqFM

29 import UniqSet

30 import Digraph (flattenSCCs)

31 import Outputable

32 import Platform

GraphBase.hs (https://github.com/pepeiborra/ghc.git) Haskell · 111 lines

16 import UniqSet

17 import UniqFM

18

19

45 = Graph {

46 -- | All active nodes in the graph.

47 graphMap :: UniqFM (Node k cls color) }

48

49

57 -- | Modify the finite map holding the nodes in the graph.

58 graphMapModify

59 :: (UniqFM (Node k cls color) -> UniqFM (Node k cls color))

60 -> Graph k cls color -> Graph k cls color

61

GraphPpr.hs (https://github.com/pepeiborra/ghc.git) Haskell · 169 lines

8 where

9

10 import GraphBase

11

12 import Outputable

13 import Unique

14 import UniqSet

15 import UniqFM

16

17 import Data.List

18 import Data.Maybe

19

20

Base.hs (https://github.com/pepeiborra/ghc.git) Haskell · 206 lines

25 #include "HsVersions.h"

26

27 import Llvm

28 import LlvmCodeGen.Regs

29

30 import CLabel

31 import CgUtils ( activeStgRegs )

32 import Config

33 import Constants

34 import FastString

35 import OldCmm

36 import qualified Outputable as Outp

37 import UniqFM

38 import Unique

Map.hs (https://github.com/bgamari/ghc.git) Haskell · 214 lines

5 {-# OPTIONS_GHC -Wall #-}

6

7 -- Like 'UniqFM', these are maps for keys which are Uniquable.

8 -- Unlike 'UniqFM', these maps also remember their keys, which

47 ) where

48

49 import GHC.Prelude

50

51 import GHC.Types.Unique.FM

52

53 import GHC.Types.Unique

54 import GHC.Utils.Outputable

55

56 import Data.Semigroup as Semi ( Semigroup(..) )

57 import Data.Coerce

ListSetOps.hs (https://github.com/typelead/eta.git) Haskell · 186 lines

21 ) where

22

23 import Eta.Utils.Outputable

24 import Eta.BasicTypes.Unique

25 import Eta.Utils.UniqFM

26 import Eta.Utils.Util

27

28 import Data.List

29

30 #include "HsVersions.h"

174

175 equivClassesByUniq :: (a -> Unique) -> [a] -> [[a]]

176 -- NB: it's *very* important that if we have the input list [a,b,c],

177 -- where a,b,c all have the same unique, then we get back the list

178 -- [a,b,c]

UniqFM.lhs (http://picorec.googlecode.com/svn/trunk/) Haskell · 233 lines

109

110 -- Bindings in right argument shadow those in the left

111 plusUFM :: UniqFM elt -> UniqFM elt -> UniqFM elt

112

113 plusUFM_C :: (elt -> elt -> elt)

118 intersectUFM :: UniqFM elt -> UniqFM elt -> UniqFM elt

119 intersectUFM_C :: (elt1 -> elt2 -> elt3)

120 -> UniqFM elt1 -> UniqFM elt2 -> UniqFM elt3

121

122 foldUFM :: (elt -> a -> a) -> a -> UniqFM elt -> a

131 elemUFM_Directly:: Unique -> UniqFM elt -> Bool

132

133 splitUFM :: Uniquable key => UniqFM elt -> key -> (UniqFM elt, Maybe elt, UniqFM elt)

134 -- Splits a UFM into things less than, equal to, and greater than the key

135 lookupUFM :: Uniquable key => UniqFM elt -> key -> Maybe elt

Ops.hs (https://github.com/bgamari/ghc.git) Haskell · 699 lines

43 import GHC.Utils.Outputable

44 import GHC.Utils.Panic

45 import GHC.Types.Unique

46 import GHC.Types.Unique.Set

47 import GHC.Types.Unique.FM

48

49 import Data.List (mapAccumL, sortBy)

678 :: Uniquable k

679 => (a -> a) -> a -> k

680 -> UniqFM k a -> UniqFM k a

681

682 adjustWithDefaultUFM f def k map

691 :: Uniquable k

692 => (a -> a)

693 -> k -> UniqFM k a -> UniqFM k a

694

695 adjustUFM_C f k map

beanshell.xml (https://jedit.svn.sourceforge.net/svnroot/jedit) XML · 103 lines

67

68 <KEYWORDS>

69 <KEYWORD2>import</KEYWORD2>

70 <KEYWORD3>byte</KEYWORD3>

71 <KEYWORD3>char</KEYWORD3>

StgCmmExtCode.hs (git://github.com/ghc/ghc.git) Haskell · 249 lines

39 import qualified StgCmmMonad as F

40 import StgCmmMonad (FCode, newUnique)

41

42 import Cmm

43 import CLabel

44 import MkGraph

45

46 -- import BasicTypes

47 import BlockId

48 import DynFlags

49 import FastString

50 import Module

51 import UniqFM

52 import Unique

FamInst.lhs (http://picorec.googlecode.com/svn/trunk/) Haskell · 213 lines

10 import TcMType

11 import TcRnMonad

12 import TyCon

13 import Name

14 import Module

15 import SrcLoc

16 import Outputable

17 import UniqFM

18 import FastString

20 import Maybes

21 import Control.Monad

22 import Data.Map (Map)

Types.hs (https://github.com/scpmw/ghc.git) Haskell · 212 lines

15 where

16

17 import CLabel

18 import FastString

19 import Outputable

20 import Platform

21 import UniqFM ( UniqFM )

22

23 import Dwarf.Constants

24

25 import Data.Bits

26 import Data.Word

Annotations.hs (https://github.com/bgamari/ghc.git) Haskell · 140 lines

18 ) where

19

20 import GHC.Prelude

21

22 import GHC.Utils.Binary

23 import GHC.Unit.Module ( Module )

24 import GHC.Unit.Module.Env

25 import GHC.Types.Name.Env

26 import GHC.Types.Name

27 import GHC.Utils.Outputable

28 import GHC.Serialized

29

30 import Control.Monad

31 import Data.Maybe

Env.hs (https://github.com/kgardas/ghc.git) Haskell · 190 lines

9 import Vectorise.Monad

10 import Vectorise.Builtins

11 import Vectorise.Type.TyConDecl

12 import Vectorise.Type.Classify

13 import Vectorise.Type.PADict

21 import CoreUtils

22 import CoreUnfold

23 import DataCon

28 import Id

29 import MkId

30 import NameEnv

32 import Unique

33 import UniqFM

34 import Util

Env.hs (https://github.com/bgamari/ghc.git) Haskell · 205 lines

42 ) where

43

44 import GHC.Prelude

45

46 import GHC.Data.Graph.Directed

47 import GHC.Types.Name

48 import GHC.Types.Unique.FM

49 import GHC.Types.Unique.DFM

50 import GHC.Data.Maybe

98

99 -- | Name Environment

100 type NameEnv a = UniqFM Name a -- Domain is Name

101

102 emptyNameEnv :: NameEnv a

Reg.hs (https://github.com/bgamari/ghc.git) Haskell · 239 lines

27 where

28

29 import GHC.Prelude

30

31 import GHC.Utils.Outputable

32 import GHC.Utils.Panic

33 import GHC.Types.Unique

34 import GHC.Builtin.Uniques

35 import GHC.Platform.Reg.Class

186

187

188 -- We like to have Uniques for Reg so that we can make UniqFM and UniqSets

189 -- in the register allocator.

190 instance Uniquable Reg where

GraphPpr.hs (https://github.com/typelead/eta.git) Haskell · 170 lines

7 where

8

9 import Eta.Utils.GraphBase

10

11 import Eta.Utils.Outputable

12 import Eta.BasicTypes.Unique

13 import Eta.Utils.UniqSet

14 import Eta.Utils.UniqFM

15

16 import Data.List

17 import Data.Maybe

18

19

UniqSet.hs (https://github.com/typelead/eta.git) Haskell · 210 lines

52 ) where

53

54 import Eta.Utils.UniqFM

55 import Eta.BasicTypes.Unique

56 import Data.Coerce

57 import Eta.Utils.Outputable

59 import Data.Data

60 #if __GLASGOW_HASKELL__ >= 801

61 import qualified Data.Semigroup

62 #endif

63

106 nonDetKeysUniqSet :: UniqSet elt -> [Unique]

107

108 -- See Note [Deterministic UniqFM] to learn about nondeterminism.

109 -- If you use this please provide a justification why it doesn't introduce

110 -- nondeterminism.

GhcPlugins.hs (https://github.com/typelead/eta.git) Haskell · 113 lines

56

57 -- Variable naming

58 import Eta.BasicTypes.RdrName

59 import Eta.BasicTypes.OccName hiding ( varName {- conflicts with Var.varName -} )

60 import Eta.BasicTypes.Name hiding ( varName {- reexport from OccName, conflicts with Var.varName -} )

61 import Eta.BasicTypes.Var

83 -- Important GHC types

84 import Eta.BasicTypes.Module

85 import Eta.Types.Type hiding {- conflict with CoreSubst -}

99 import Eta.Utils.UniqSet

100 import Eta.Utils.UniqFM

101 -- Conflicts with UniqFM:

102 --import LazyUniqFM

103 import Eta.Utils.FiniteMap

Base.hs (https://github.com/bgamari/ghc.git) Haskell · 188 lines

23 where

24

25 import GHC.Prelude

26

27 import GHC.CmmToAsm.Reg.Linear.StackMap

28 import GHC.CmmToAsm.Reg.Liveness

29 import GHC.CmmToAsm.Config

30 import GHC.Platform.Reg

31

32 import GHC.Utils.Outputable

33 import GHC.Types.Unique

34 import GHC.Types.Unique.FM

Env.hs (https://github.com/bgamari/ghc.git) Haskell · 145 lines

34 ) where

35

36 import GHC.Prelude

37

38 import GHC.Types.Unique.FM

39 import GHC.Types.Unique.DFM

40 import GHC.Core.TyCon (TyCon)

41

42 import GHC.Data.Maybe

43

44 {-

51

52 -- | TyCon Environment

53 type TyConEnv a = UniqFM TyCon a -- Domain is TyCon

54

55 emptyTyConEnv :: TyConEnv a

NameEnv.hs (https://github.com/typelead/eta.git) Haskell · 114 lines

27 #include "HsVersions.h"

28

29 import Eta.Utils.Digraph

30 import Eta.BasicTypes.Name

31 import Eta.Utils.UniqFM

32 import Eta.Utils.Maybes

65 -}

66

67 type NameEnv a = UniqFM a -- Domain is Name

68

69 emptyNameEnv :: NameEnv a

StackMap.hs (https://github.com/pepeiborra/ghc.git) Haskell · 72 lines

20 where

21

22 import RegAlloc.Linear.FreeRegs

23

24 import Outputable

25 import Platform

26 import UniqFM

27 import Unique

37

38 -- | Assignment of vregs to stack slots.

39 , stackMapAssignment :: UniqFM StackSlot }

40

41

Stats.hs (https://github.com/bgamari/ghc.git) Haskell · 91 lines

7 where

8

9 import GHC.Prelude

10

11 import GHC.CmmToAsm.Reg.Linear.Base

12 import GHC.CmmToAsm.Reg.Liveness

13 import GHC.CmmToAsm.Instr

14 import GHC.Types.Unique (Unique)

15 import GHC.CmmToAsm.Types

16

17 import GHC.Types.Unique.FM

18

19 import GHC.Utils.Outputable

UniqDSet.hs (https://github.com/typelead/eta.git) Haskell · 106 lines

5 --

6 -- Based on @UniqDFMs@ (as you would expect).

7 -- See Note [Deterministic UniqFM] in UniqDFM for explanation why we need it.

8 --

9 -- Basically, the things need to be in class @Uniquable@.

11 module Eta.Utils.UniqDSet (

12 -- * Unique set type

13 UniqDSet, -- type synonym for UniqFM a

14

15 -- ** Manipulating these sets

33 ) where

34

35 import Eta.Utils.UniqDFM

36 import Eta.Utils.UniqSet

37 import Eta.BasicTypes.Unique

38

39 type UniqDSet a = UniqDFM a

FilePropertiesDialog.java (https://jedit.svn.sourceforge.net/svnroot/jedit) Java · 333 lines ✨ Summary

This Java code creates a graphical user interface (GUI) for managing file properties, such as name, path, last modified date, and permissions. It allows users to rename files, view and modify file attributes, and cancel changes. The GUI is designed to be simple and easy to use, with features like auto-saving the window’s geometry and focus on the first visible element.

22 package org.gjt.sp.jedit.gui;

23

24 //{{{ Imports

25 import java.io.File;

26

27 import java.awt.BorderLayout;

28 import java.awt.GridLayout;

29 import java.awt.event.ActionEvent;

30 import java.awt.event.ActionListener;

31 import java.text.SimpleDateFormat;

32 import java.util.Date;

33

34 import javax.swing.*;

35 import javax.swing.border.Border;

users-guide.xsl (https://jedit.svn.sourceforge.net/svnroot/jedit) Extensible Stylesheet Language Transformations · 284 lines

9 <!-- (for a single html page) or chunk.xsl (for multiple pages) in your -->

10 <!-- installation of the DocBook XSL stylesheets. -->

11 <xsl:import href="I:/sgml/docbook-xsl-1.45/html/onechunk.xsl"/>

12

13 <xsl:param name="use.id.as.filename" select="'1'" doc:type="boolean"/>

GraphBase.hs (https://github.com/typelead/eta.git) Haskell · 105 lines

15 import Eta.Utils.UniqSet

16 import Eta.Utils.UniqFM

17

18

44 = Graph {

45 -- | All active nodes in the graph.

46 graphMap :: UniqFM (Node k cls color) }

47

48

56 -- | Modify the finite map holding the nodes in the graph.

57 graphMapModify

58 :: (UniqFM (Node k cls color) -> UniqFM (Node k cls color))

59 -> Graph k cls color -> Graph k cls color

60

GraphOps.hs (https://github.com/typelead/eta.git) Haskell · 677 lines

25 import Eta.Utils.UniqSet

26 import Eta.Utils.UniqFM

27

28 import Data.List hiding (union)

29 import Data.Maybe

30

31 -- | Lookup a node from the graph.

657 :: Uniquable k

658 => (a -> a) -> a -> k

659 -> UniqFM a -> UniqFM a

660

661 adjustWithDefaultUFM f def k map

670 :: Uniquable k

671 => (a -> a)

672 -> k -> UniqFM a -> UniqFM a

673

674 adjustUFM_C f k map

TrieMap.hs (https://github.com/typelead/eta.git) Haskell · 839 lines

15 ) where

16

17 import Eta.Core.CoreSyn

18 import Eta.Types.Coercion

19 import Eta.BasicTypes.Literal

20 import Eta.BasicTypes.Name

21 import Eta.Types.Type

22 import Eta.Types.TypeRep

23 import Eta.Types.TyCon(TyCon)

24 import Eta.BasicTypes.Var

25 import Eta.Utils.UniqFM

26 import Eta.BasicTypes.Unique( Unique )

27 import Eta.Utils.FastString(FastString)

28 import Eta.Types.CoAxiom(CoAxiomRule(coaxrName))

DSet.hs (https://github.com/bgamari/ghc.git) Haskell · 142 lines

5 --

6 -- Based on 'UniqDFM's (as you would expect).

7 -- See Note [Deterministic UniqFM] in "GHC.Types.Unique.DFM" for explanation why we need it.

8 --

9 -- Basically, the things need to be in class 'Uniquable'.

13 module GHC.Types.Unique.DSet (

14 -- * Unique set type

15 UniqDSet, -- type synonym for UniqFM a

16 getUniqDSet,

17 pprUniqDSet,

37 ) where

38

39 import GHC.Prelude

40

41 import GHC.Utils.Outputable

CmmLex.hs (http://picorec.googlecode.com/svn/trunk/) Haskell · 507 lines

15 import Cmm

16 import Lexer

17

18 import SrcLoc

19 import UniqFM

20 import StringBuffer

23 import Util

24 --import TRACE

25

26 #if __GLASGOW_HASKELL__ >= 603

33 import Data.Char (ord)

34 import Data.Array.Base (unsafeAt)

35 #else

36 import Array

CoreTidy.lhs (http://picorec.googlecode.com/svn/trunk/) Haskell · 237 lines

14 #include "HsVersions.h"

15

16 import CoreSyn

17 import CoreArity

18 import Id

19 import IdInfo

20 import TcType( tidyType, tidyTyVarBndr )

21 import Var

22 import VarEnv

23 import UniqFM

24 import Name hiding (tidyNameOcc)

25 import SrcLoc

26 import Maybes

ListSetOps.lhs (http://picorec.googlecode.com/svn/trunk/) Haskell · 225 lines

20 ) where

21

22 import Outputable

23 import Unique

24 import UniqFM

25 import Util

26

27 import Data.List

28 \end{code}

29

210 \begin{code}

211 equivClassesByUniq :: (a -> Unique) -> [a] -> [[a]]

212 -- NB: it's *very* important that if we have the input list [a,b,c],

213 -- where a,b,c all have the same unique, then we get back the list

214 -- [a,b,c]

CmmCommonBlockElimZ.hs (http://picorec.googlecode.com/svn/trunk/) Haskell · 165 lines

5

6

7 import BlockId

8 import CmmExpr

9 import Prelude hiding (iterate, zip, unzip)

10 import ZipCfg

11 import ZipCfgCmmRep

13 import Data.Bits

14 import qualified Data.List as List

15 import Data.Word

16 import FastString

17 import Control.Monad

18 import Outputable

19 import UniqFM

20 import Unique

Base.hs (https://github.com/bgamari/ghc.git) Haskell · 107 lines

13 where

14

15 import GHC.Prelude

16

17 import GHC.Types.Unique.Set

18 import GHC.Types.Unique.FM

19

20

46 = Graph {

47 -- | All active nodes in the graph.

48 graphMap :: UniqFM k (Node k cls color) }

49

50

58 -- | Modify the finite map holding the nodes in the graph.

59 graphMapModify

60 :: (UniqFM k (Node k cls color) -> UniqFM k (Node k cls color))

61 -> Graph k cls color -> Graph k cls color

62

VarSet.hs (https://github.com/typelead/eta.git) Haskell · 348 lines

46 #include "HsVersions.h"

47

48 import Eta.BasicTypes.Var ( Var, TyVar, CoVar, TyCoVar, Id )

49 import Eta.BasicTypes.Unique

50 import Eta.BasicTypes.Name ( Name )

51 import Eta.Utils.UniqSet

52 import Eta.Utils.UniqDSet

53 import Eta.Utils.UniqFM( disjointUFM, pluralUFM, pprUFM )

54 import Eta.Utils.UniqDFM( disjointUDFM, udfmToUfm, anyUDFM, allUDFM )

55 import Eta.Utils.Outputable (SDoc)

56

57 -- | A non-deterministic Variable Set

58 --

59 -- A non-deterministic set of variables.

60 -- See Note [Deterministic UniqFM] in UniqDFM for explanation why it's not

61 -- deterministic and why it matters. Use DVarSet if the set eventually

62 -- gets converted into a list or folded over in a way where the order

RewritePlugin.hs (https://github.com/bgamari/ghc.git) Haskell · 87 lines

6

7 -- base

8 import Data.Maybe

9 ( catMaybes )

10

11 -- ghc

12 import GHC.Builtin.Types

13 ( unitTy )

14 import GHC.Core

15 ( Expr(Coercion) )

16 import GHC.Core.Coercion

17 ( Coercion, mkUnivCo )

18 import GHC.Core.Predicate

NameSet.hs (https://github.com/typelead/eta.git) Haskell · 209 lines

29 ) where

30

31 import Eta.BasicTypes.Name

32 import Eta.Utils.UniqSet

33 import Data.List ( sortBy )

34

35 {-

92 -- This only works for Names that originate in the source code or have been

93 -- tidied.

94 -- See Note [Deterministic UniqFM] to learn about nondeterminism

95 nameSetElemsStable :: NameSet -> [Name]

96 nameSetElemsStable ns =

Stats.hs (https://github.com/ezyang/ghc.git) Haskell · 88 lines

7 where

8

9 import GhcPrelude

10

11 import RegAlloc.Linear.Base

12 import RegAlloc.Liveness

13 import Instruction

14

15 import UniqFM

16 import Outputable

17

18 import Data.List

19 import State

Stats.hs (https://github.com/dagit/ghc.git) Haskell · 86 lines

7 where

8

9 import RegAlloc.Linear.Base

10 import RegAlloc.Liveness

11 import Instruction

12

13 import UniqFM

14 import Outputable

15

16 import Data.List

17 import State

19 -- | Build a map of how many times each reg was alloced, clobbered, loaded etc.

20 binSpillReasons

21 :: [SpillReason] -> UniqFM [Int]

22

23 binSpillReasons reasons

Stats.hs (http://picorec.googlecode.com/svn/trunk/) Haskell · 288 lines

23 import RegAlloc.Graph.SpillCost

24 import RegAlloc.Graph.TrivColorable

25 import Instruction

27 import Reg

28 import TargetReg

29

30 import Cmm

31 import Outputable

32 import UniqFM

33 import UniqSet

194 $$ text "\n")

195

196 binLifetimeCount :: UniqFM (VirtualReg, Int) -> UniqFM (Int, Int)

197 binLifetimeCount fm

198 = let lifes = map (\l -> (l, (l, 1)))

RegInfo.hs (https://github.com/bgamari/ghc.git) Haskell · 72 lines

7 where

8

9 import GHC.Prelude

10

11 import GHC.CmmToAsm.Format

12 import GHC.Platform.Reg

13

14 import GHC.Utils.Outputable

15 import GHC.Utils.Panic

16 import GHC.Platform

17 import GHC.Types.Unique

18

19 import GHC.Types.Unique.FM

ExtCode.hs (https://github.com/bgamari/ghc.git) Haskell · 260 lines

26 newBlockId,

27 newFunctionName,

28 newImport,

29 lookupLabel,

30 lookupName,

40 where

41

42 import GHC.Prelude

43

44 import GHC.Platform

45 import GHC.Platform.Profile

46

47 import qualified GHC.StgToCmm.Monad as F

48 import GHC.StgToCmm.Monad (FCode, newUnique)

49

50 import GHC.Cmm

Plugin.hs (git://pkgs.fedoraproject.org/ghc) Haskell · 83 lines

3 module Simple.Plugin(plugin) where

4

5 import UniqFM

6 import GhcPlugins

7 import qualified ErrUtils

8

9 -- For annotation tests

10 import Simple.DataStructures

11

12 import Control.Monad

13 import Data.Monoid

14 import Data.Dynamic

Base.hs (https://github.com/nominolo/ghc.git) Haskell · 137 lines

19 where

20

21 import RegAlloc.Linear.FreeRegs

22 import RegAlloc.Linear.StackMap

23 import RegAlloc.Liveness

24 import Reg

25

26 import Outputable

27 import Unique

28 import UniqFM

29 import UniqSupply

98 data RegAllocStats

99 = RegAllocStats

100 { ra_spillInstrs :: UniqFM [Int] }

101

102

Stats.hs (https://github.com/axman6/ghc.git) Haskell · 88 lines

7 where

8

9 import RegAlloc.Linear.Base

10 import RegAlloc.Liveness

11 import Instruction

12

13 import OldCmm (GenBasicBlock(..))

14

15 import UniqFM

16 import Outputable

17

18 import Data.List

19 import State

RegInfo.hs (https://github.com/ezyang/ghc.git) Haskell · 69 lines

10 #include "HsVersions.h"

11

12 import GhcPrelude

13

14 import Format

15 import Reg

16

17 import Outputable

18 import Platform

19 import Unique

20

21 import UniqFM

22 import X86.Regs

StackMap.hs (https://github.com/bgamari/ghc.git) Haskell · 61 lines

21 where

22

23 import GHC.Prelude

24

25 import GHC.Types.Unique.FM

26 import GHC.Types.Unique

27

28

35 stackMapNextFreeSlot :: !Int

36

37 -- See Note [UniqFM and the register allocator]

38 -- | Assignment of vregs to stack slots.

39 , stackMapAssignment :: UniqFM Unique StackSlot }

RegInfo.hs (https://github.com/nominolo/ghc.git) Haskell · 88 lines

10 #include "HsVersions.h"

11

12 import Size

13 import Reg

14

15 import Outputable

16 import Unique

17

18 #if i386_TARGET_ARCH || x86_64_TARGET_ARCH

19 import UniqFM

20 import X86.Regs

38 in text str

39

40 regColors :: UniqFM [Char]

41 regColors

42 = listToUFM

Annotations.hs (git://github.com/ghc/ghc.git) Haskell · 133 lines

20 import Binary

21 import Module ( Module )

22 import Name

23 import Outputable

24 import GHC.Serialized

25 import UniqFM

26 import Unique

28 import Control.Monad

29 import Data.Maybe

30 import Data.Typeable

31 import Data.Word ( Word8 )

32

33

Env.hs (https://github.com/bgamari/ghc.git) Haskell · 100 lines

28 ) where

29

30 import GHC.Prelude

31

32 import GHC.Types.Unique.FM

33 import GHC.Types.Unique.DFM

34 import GHC.Data.Maybe

35 import GHC.Data.FastString

36

37

38 -- | A non-deterministic set of FastStrings.

39 -- See Note [Deterministic UniqFM] in "GHC.Types.Unique.DFM" for explanation why it's not

40 -- deterministic and why it matters. Use DFastStringEnv if the set eventually

41 -- gets converted into a list or folded over in a way where the order

Show.hs (https://github.com/mikeizbicki/HerbiePlugin.git) Haskell · 160 lines

17 module Show where

18

19 import Data.IORef

20 import Data.List (intercalate)

21 import System.IO.Unsafe (unsafePerformIO)

22

23 import Class

24 import CostCentre

25 import ForeignCall

26 import Demand

27 import GhcPlugins

28 import IdInfo

29 import PrimOp

FV.hs (https://github.com/typelead/eta.git) Haskell · 210 lines

28 ) where

29

30 import Eta.BasicTypes.Var

31 import Eta.BasicTypes.VarSet

38 -- ~~~~~~~~~~~~~~~~~~~~~~~

39 -- When computing free variables, the order in which you get them affects

40 -- the results of floating and specialization. If you use UniqFM to collect

41 -- them and then turn that into a list, you get them in nondeterministic

42 -- order as described in Note [Deterministic UniqFM] in UniqDFM.

43

44 -- A naive algorithm for free variables relies on merging sets of variables.

45 -- Merging costs O(n+m) for UniqFM and for UniqDFM there's an additional log

46 -- factor. It's cheaper to incrementally add to a list and use a set to check

47 -- for duplicates.

54 -- so that the list doesn't have duplicates

55 -- For explanation of why using `VarSet` is not deterministic see

56 -- Note [Deterministic UniqFM] in UniqDFM.

57 -> ([Var], VarSet)

58

BlockId.hs (http://picorec.googlecode.com/svn/trunk/) Haskell · 160 lines

11 ) where

12

13 import CLabel

14 import IdInfo

15 import Maybes

16 import Name

17 import Outputable

18 import UniqFM

19 import Unique

20 import UniqSet

21

22 ----------------------------------------------------------------

57

58 -- Block environments: Id blocks

59 newtype BlockEnv a = BlockEnv (UniqFM {- id -} a)

60

61 instance Outputable a => Outputable (BlockEnv a) where

UnblockingMessageImpl.java (http://mobicents.googlecode.com/svn/trunk/) Java · 131 lines ✨ Summary

This Java class implements an UnblockingMessage, a type of message in the ISUP (Intelligent Switching System) protocol. It extends another class and provides specific implementations for decoding and processing message parameters. The class includes methods for getting the message type, checking mandatory parameter presence, and handling optional parameters, which are not supported in this implementation.

29 package org.mobicents.protocols.ss7.isup.impl.message;

30

31 import java.util.Map;

32 import java.util.Set;

33

34 import org.mobicents.protocols.ss7.isup.ISUPParameterFactory;

35 import org.mobicents.protocols.ss7.isup.ParameterException;

36 import org.mobicents.protocols.ss7.isup.impl.message.parameter.MessageTypeImpl;

37 import org.mobicents.protocols.ss7.isup.message.UnblockingMessage;

38 import org.mobicents.protocols.ss7.isup.message.parameter.MessageType;

39

40 /**

Utils.hs (https://github.com/bgamari/ghc.git) Haskell · 58 lines

3 where

4

5 {- Note [UniqFM and the register allocator]

6 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

7 Before UniqFM had a key type the register allocator

51 -- These should hopefully be zero cost.

52

53 toRegMap :: UniqFM VirtualReg elt -> UniqFM Reg elt

54 toRegMap = unsafeCastUFMKey

55

56 toVRegMap :: UniqFM Reg elt -> UniqFM VirtualReg elt

57 toVRegMap = unsafeCastUFMKey

58

GhcUtils.hs (http://picorec.googlecode.com/svn/trunk/) Haskell · 247 lines

21 import Data.Foldable hiding (concatMap)

22 import Data.Traversable

23 import Distribution.Compat.ReadP

24 import Distribution.Text

25

26 import Exception

27 import Outputable

28 import Name

29 import Packages

30 import Module

31 import RdrName (GlobalRdrEnv)

35 import HscTypes

36 import UniqFM

37 import GHC

VarSet.hs (git://github.com/ghc/ghc.git) Haskell · 335 lines

45 #include "HsVersions.h"

46

47 import Var ( Var, TyVar, CoVar, TyCoVar, Id )

48 import Unique

49 import Name ( Name )

50 import UniqSet

51 import UniqDSet

52 import UniqFM( disjointUFM, pluralUFM, pprUFM )

53 import UniqDFM( disjointUDFM, udfmToUfm )

54 import Outputable (SDoc)

55

56 -- | A non-deterministic Variable Set

57 --

58 -- A non-deterministic set of variables.

59 -- See Note [Deterministic UniqFM] in UniqDFM for explanation why it's not

60 -- deterministic and why it matters. Use DVarSet if the set eventually

61 -- gets converted into a list or folded over in a way where the order

DebugGhcAST.hs (https://github.com/haskell-tools/haskell-tools.git) Haskell · 393 lines

12 import BasicTypes

13 import BooleanFormula (BooleanFormula(..))

14 import Coercion (Var(..), Role(..))

15 import ConLike (ConLike(..))

16 import CoreSyn (Tickish(..))

18 import ForeignCall

19 import GHC

20 import Module (Module(..), ModuleName(..))

21 import OccName (OccName(..))

22 import Outputable (Outputable(..), showSDocUnsafe)

23 import PatSyn (PatSyn(..))

25 import TcEvidence

26 import UniqFM (UniqFM(..))

27 import UniqSet (UniqSet(..))

Annotations.lhs (http://picorec.googlecode.com/svn/trunk/) Haskell · 102 lines

19 import Name

20 import Module ( Module )

21 import Outputable

22 import UniqFM

23 import Serialized

24 import Unique

25

26 import Data.Typeable

27 import Data.Maybe

28 import Data.Word ( Word8 )

29

30

68

69 -- | A collection of annotations

70 newtype AnnEnv = MkAnnEnv (UniqFM [Serialized])

71 -- Can't use a type synonym or we hit bug #2412 due to source import

CgExtCode.hs (http://picorec.googlecode.com/svn/trunk/) Haskell · 230 lines

21 newLabel,

22 newFunctionName,

23 newImport,

24 lookupLabel,

25 lookupName,

42 import Cmm

43

44 -- import BasicTypes

45 import BlockId

47 import Module

48 import UniqFM

49 import Unique

59

60 -- | An environment of named things.

61 type Env = UniqFM Named

62

63 -- | Local declarations that are in scope during code generation.

Base.hs (https://github.com/kgardas/ghc.git) Haskell · 136 lines

19 where

20

21 import RegAlloc.Linear.StackMap

22 import RegAlloc.Liveness

23 import Reg

24

25 import Outputable

26 import Unique

27 import UniqFM

28 import UniqSupply

97 data RegAllocStats

98 = RegAllocStats

99 { ra_spillInstrs :: UniqFM [Int] }

100

101

Annotations.hs (https://github.com/typelead/eta.git) Haskell · 133 lines

19 import Eta.Utils.Binary

20 import Eta.BasicTypes.Module ( Module )

21 import Eta.BasicTypes.Name

22 import Eta.Utils.Outputable

23 import Eta.Utils.UniqFM

24 import Eta.BasicTypes.Unique

25 import Eta.Serialized

26 import Control.Monad

27 import Data.Maybe

28 import Data.Typeable

29 import Data.Word ( Word8 )

30

31

cookie.py (https://code.google.com/p/mango-py/) Python · 153 lines ✨ Summary

This Django code implements a custom storage system for storing and retrieving messages, which are used to display notifications to users. It stores messages in a cookie on the client-side, allowing them to be retrieved and displayed dynamically. The code includes encryption and hashing to ensure data integrity and security.

1 from django.conf import settings

2 from django.contrib.messages import constants

3 from django.contrib.messages.storage.base import BaseStorage, Message

4 from django.http import SimpleCookie

5 from django.utils import simplejson as json

6 from django.utils.crypto import salted_hmac, constant_time_compare

Interpreter.hs (git://github.com/iand675/Zoom.git) Haskell · 117 lines

5 import PackageConfig

6 import UniqFM

7 import qualified HscTypes as GHC

46 , searchPath := ["./tasks"]]

47 loadLocalTaskModules

48 qualified <- importZoomTasks imports

49 taskStrings <- availableTasks qualified

50 tasks <- mapM (\x -> interpret x (as :: Task s)) taskStrings

70 importZoomTasks :: [String] -> Interpreter [ModuleName]

71 importZoomTasks imports = do

72 localModules <- getLoadedModules

73 globalModules <- getAvailableModules

85

86 runZoomInterpreter :: (Typeable s, Retrieve s) => [String] -> IO (Either InterpreterError [(String, Task s)])

87 runZoomInterpreter imports = runInterpreter $ interpreterMain imports

88

89

Bag.hs (https://github.com/facebookincubator/retrie.git) Haskell · 164 lines

120

121 newtype FSEnv a =

122 FSEnv { _unFSEnv :: UniqFM a } -- this is the UniqFM below, NOT GHC's UniqFM

123 deriving (Functor)

124

140 ------------------------------------------------------------------------

141

142 newtype UniqFM a = UniqFM { unUniqFM :: GHC.UniqFM [a] }

143 deriving (Functor)

144

149 mEmpty = UniqFM GHC.emptyUFM

150

151 mUnion :: UniqFM a -> UniqFM a -> UniqFM a

152 mUnion (UniqFM m1) (UniqFM m2) = UniqFM $ GHC.plusUFM_C (++) m1 m2

153

154 mAlter :: AlphaEnv -> Quantifiers -> Key UniqFM -> A a -> UniqFM a -> UniqFM a

155 mAlter _ _ k f (UniqFM m) = UniqFM $ GHC.alterUFM (toAList f) m k

SpillCost.hs (git://github.com/ghc/ghc.git) Haskell · 292 lines ✨ Summary

This Haskell code is part of a compiler’s allocator, specifically for handling spills (temporary storage) of registers during compilation. It calculates the cost of spilling a live range, which determines whether to spill from the inside out or outside in, and how to allocate stack slots. The code uses graph theory and data structures like graphs, maps, and sets to efficiently manage register lifetimes and conflicts.

16 import RegAlloc.Liveness

17 import Instruction

18 import RegClass

19 import Reg

20

21 import GraphBase

22

23 import BlockId

24 import Cmm

25 import UniqFM

26 import UniqSet

27 import Digraph (flattenSCCs)

28 import Outputable

29 import Platform

Classify.hs (git://github.com/ghc/ghc.git) Haskell · 129 lines ✨ Summary

The classifyTyCons function classifies a list of type constructors into three categories: those that must be vectorized, those that need not be vectorized but could be, and those that cannot be converted. It uses a graph-based approach to identify mutually recursive groups of tycons and determines their conversion status based on the presence of parallel arrays and other factors.

19 where

20

21 import NameSet

22 import UniqSet

23 import UniqFM

24 import DataCon

25 import TyCon

26 import TyCoRep

27 import qualified Type

28 import PrelNames

29 import Digraph

30

31 -- |From a list of type constructors, extract those that can be vectorised, returning them in two

FastStringEnv.hs (git://github.com/ghc/ghc.git) Haskell · 96 lines

28 ) where

29

30 import UniqFM

31 import UniqDFM

32 import Maybes

33 import FastString

35

36 -- | A non-deterministic set of FastStrings.

37 -- See Note [Deterministic UniqFM] in UniqDFM for explanation why it's not

38 -- deterministic and why it matters. Use DFastStringEnv if the set eventually

39 -- gets converted into a list or folded over in a way where the order

40 -- changes the generated code.

41 type FastStringEnv a = UniqFM a -- Domain is FastString

42

43 emptyFsEnv :: FastStringEnv a

SpillCost.hs (http://picorec.googlecode.com/svn/trunk/) Haskell · 278 lines

21 import RegClass

22 import Reg

23

24 import GraphBase

25

26 import BlockId

27 import Cmm

28 import UniqFM

29 import UniqSet

31 import Outputable

32 import State

33

34 import Data.List (nub, minimumBy)

NameSet.hs (git://github.com/ghc/ghc.git) Haskell · 214 lines

34 #include "HsVersions.h"

35

36 import Name

37 import UniqSet

38 import UniqFM

39 import Data.List (sortBy)

94 -- This only works for Names that originate in the source code or have been

95 -- tidied.

96 -- See Note [Deterministic UniqFM] to learn about nondeterminism

97 nameSetElemsStable :: NameSet -> [Name]

98 nameSetElemsStable ns =

Types.hs (https://github.com/bgamari/ghc.git) Haskell · 74 lines

12 where

13

14 import GHC.Prelude

15 import GHC.Linker.Types

16

17 import GHCi.RemoteTypes

18 import GHCi.Message ( Pipe )

19 import GHC.Types.Unique.FM

20 import GHC.Data.FastString ( FastString )

21 import Foreign

22

23 import Control.Concurrent

NameEnv.hs (git://github.com/ghc/ghc.git) Haskell · 152 lines

34 #include "HsVersions.h"

35

36 import Digraph

37 import Name

38 import UniqFM

39 import UniqDFM

40 import Maybes

41

42 {-

84

85 -- | Name Environment

86 type NameEnv a = UniqFM a -- Domain is Name

87

88 emptyNameEnv :: NameEnv a

CmmParse.hs (git://pkgs.fedoraproject.org/ghc) Haskell · 2919 lines

14 import CgExtCode

15 import CgHeapery

16 import CgUtils

17 import CgProf

18 import CgTicky

19 import CgInfoTbls

20 import CgForeignCall

35 import Lexer

36

37 import ForeignCall

38 import Module

40 import Unique

41 import UniqFM

42 import SrcLoc

CmmLex.hs (git://pkgs.fedoraproject.org/ghc) Haskell · 518 lines

19 import SrcLoc

20 import UniqFM

21 import StringBuffer

27 import Data.Word

28 import Data.Char

29

30 #if __GLASGOW_HASKELL__ >= 603

34 #endif

35 #if __GLASGOW_HASKELL__ >= 503

36 import Data.Array

37 import Data.Char (ord)

168 ( "return", CmmT_return ),

169 ( "returns", CmmT_returns ),

170 ( "import", CmmT_import ),

171 ( "switch", CmmT_switch ),

172 ( "case", CmmT_case ),

Types.hs (https://github.com/facebookincubator/retrie.git) Haskell · 65 lines

10 module Retrie.Rewrites.Types where

11

12 import Control.Monad

13 import Data.Maybe

14

15 import Retrie.ExactPrint

16 import Retrie.Expr

17 import Retrie.GHC

18 import Retrie.Quantifiers

19 import Retrie.Types

20

21 typeSynonymsToRewrites

NameEnv.lhs (http://picorec.googlecode.com/svn/trunk/) Haskell · 84 lines

23 #include "HsVersions.h"

24

25 import Name

26 import Unique

27 import UniqFM

28 import Maybes

36

37 \begin{code}

38 type NameEnv a = UniqFM a -- Domain is Name

39

40 emptyNameEnv :: NameEnv a

Stats.hs (http://picorec.googlecode.com/svn/trunk/) Haskell · 89 lines

7 where

8

9 import RegAlloc.Linear.Base

10 import RegAlloc.Liveness

11 import Instruction

12

13 import Cmm (GenBasicBlock(..))

14

15 import UniqFM

16 import Outputable

17

18 import Data.List

19 import State

UniqSet.hs (git://github.com/ghc/ghc.git) Haskell · 123 lines

5 \section[UniqSet]{Specialised sets, for things with @Uniques@}

6

7 Based on @UniqFMs@ (as you would expect).

8

9 Basically, the things need to be in class @Uniquable@.

12 module UniqSet (

13 -- * Unique set type

14 UniqSet, -- type synonym for UniqFM a

15

16 -- ** Manipulating these sets

33 ) where

34

35 import UniqFM

36 import Unique

73 ************************************************************************

74 * *

75 \subsection{Implementation using ``UniqFM''}

76 * *

77 ************************************************************************

GHC.hs (https://github.com/facebookincubator/retrie.git) Haskell · 211 lines

34 import Bag

35 import BasicTypes

36 import FastString

37 import FastStringEnv

38 #if __GLASGOW_HASKELL__ < 810

39 import HsExpr

46 import ErrUtils

47 import GHC.Hs.Expr

48 import GHC.Hs

49 #endif

50 import Module

51 import Name

55 import Unique

56 import UniqFM

57 import UniqSet

Function.hs (https://github.com/facebookincubator/retrie.git) Haskell · 168 lines

15 import Control.Monad.State.Lazy

16 import Data.List

17 import Data.Maybe

18 import Data.Traversable

19

20 import Retrie.ExactPrint

21 import Retrie.Expr

22 import Retrie.GHC

35 [ do

36 fe <- mkLocatedHsVar fRdrName

37 imps <- getImports dir (hsmodName m)

38 (fName,) . concat <$>

39 forM (unLoc $ mg_alts $ fun_matches f) (matchToRewrites fe imps dir)

56 getImports RightToLeft (Just (L _ mn)) = -- See Note [fold only]

57 lift $ liftIO $ parseImports ["import " ++ moduleNameString mn]

58 getImports _ _ = return mempty

GraphBase.hs (git://github.com/ghc/ghc.git) Haskell · 106 lines ✨ Summary

This Haskell code defines a graph coloring system, allowing for the creation of graphs with nodes that have specific classes, exclusions, and preferences for colors. It provides functions to initialize an empty graph, modify its node map, create new nodes, and check if a node is trivially colorable based on its neighbors and exclusions.

15 import UniqSet

16 import UniqFM

17

18

44 = Graph {

45 -- | All active nodes in the graph.

46 graphMap :: UniqFM (Node k cls color) }

47

48

56 -- | Modify the finite map holding the nodes in the graph.

57 graphMapModify

58 :: (UniqFM (Node k cls color) -> UniqFM (Node k cls color))

59 -> Graph k cls color -> Graph k cls color

60

Coalesce.hs (http://picorec.googlecode.com/svn/trunk/) Haskell · 89 lines

9 where

10

11 import RegAlloc.Liveness

12 import Instruction

13 import Reg

14

15 import Cmm

17 import Digraph

18 import UniqFM

19 import UniqSet

44

45

46 buildAlloc :: UniqFM Reg -> (Reg, Reg) -> UniqFM Reg

47 buildAlloc fm (r1, r2)

48 = let rmin = min r1 r2

SpillClean.hs (git://github.com/ghc/ghc.git) Haskell · 612 lines ✨ Summary

This Haskell code implements a spill cleaner for a compiler, which is responsible for allocating virtual registers to physical registers during compilation. It manages associations between store locations (stack slots and registers) based on their values, allowing it to identify and eliminate unnecessary allocations. The code provides functions for adding, deleting, and checking associations, as well as finding the reflection transitive closure of an association.

29 cleanSpills

30 ) where

31 import RegAlloc.Liveness

32 import Instruction

33 import Reg

34

35 import BlockId

36 import Cmm

37 import UniqSet

38 import UniqFM

39 import Unique

41 import Outputable

42 import Platform

43

44 import Data.List

GraphOps.hs (git://github.com/ghc/ghc.git) Haskell · 679 lines ✨ Summary

This Haskell code provides functions for manipulating graphs, specifically graph operations such as validating, coloring, and counting node conflicts. It ensures that a graph is valid by checking that all edges point to existing nodes and that no conflicting nodes have the same color. The code also allows setting the color of specific nodes and slursping out maps of node conflict counts.

25 import UniqSet

26 import UniqFM

27

28 import Data.List hiding (union)

29 import Data.Maybe

30

31 -- | Lookup a node from the graph.

657 :: Uniquable k

658 => (a -> a) -> a -> k

659 -> UniqFM a -> UniqFM a

660

661 adjustWithDefaultUFM f def k map

670 :: Uniquable k

671 => (a -> a)

672 -> k -> UniqFM a -> UniqFM a

673

674 adjustUFM_C f k map

RegInfo.hs (git://github.com/ghc/ghc.git) Haskell · 68 lines ✨ Summary

This Haskell code defines a module for generating information about x86 registers, including virtual register types and colors associated with each register on different platforms. It uses platform-specific data to determine the color of a given register, which is then used in outputable formats. The code includes definitions for virtual register types, normal reg colors, and fake fp reg colors.

10 #include "HsVersions.h"

11

12 import Format

13 import Reg

14

15 import Outputable

16 import Platform

17 import Unique

18

19 import UniqFM

20 import X86.Regs

34 in text str

35

36 regColors :: Platform -> UniqFM [Char]

37 regColors platform = listToUFM (normalRegColors platform ++ fpRegColors)

38

NameEnv.lhs (git://github.com/ghc/ghc.git) Haskell · 123 lines ✨ Summary

This Haskell code defines a module for working with name environments, which are used to manage variables and their bindings in a programming language. It provides functions for creating, manipulating, and querying these environments, including adding, removing, and looking up bindings, as well as performing dependency analysis on definitions. The code is designed to be flexible and reusable.

33 #include "HsVersions.h"

34

35 import Digraph

36 import Name

37 import Unique

38 import UniqFM

39 import Maybes

73

74 \begin{code}

75 type NameEnv a = UniqFM a -- Domain is Name

76

77 emptyNameEnv :: NameEnv a

Classify.hs (git://github.com/ilyasergey/GHC-XAppFix.git) Haskell · 117 lines

20 import UniqSet

21 import UniqFM

22 import DataCon

23 import TyCon

24 import TypeRep

25 import Type

26 import PrelNames

27 import Digraph

28

29

40 -- * tycons which can't be converted are not elements of the map

41 --

42 classifyTyCons :: UniqFM Bool -- ^type constructor conversion status

43 -> [TyCon] -- ^type constructors that need to be classified

44 -> ([TyCon], [TyCon], [TyCon]) -- ^tycons to be converted & not to be converted

TrieMap.lhs (git://github.com/ilyasergey/GHC-XAppFix.git) Haskell · 614 lines

24 import CoreSyn

25 import Coercion

26 import Literal

27 import Name

28 import Type

29 import TypeRep

30 import Var

31 import UniqFM

32 import Unique( Unique )

34 import qualified Data.Map as Map

35 import qualified Data.IntMap as IntMap

36 import VarEnv

UniqFM.lhs (git://github.com/ghc/ghc.git) Haskell · 275 lines ✨ Summary

This Haskell code defines a data structure UniqFM to represent an unordered map (dictionary) with unique keys, and provides various functions for manipulating and querying this data structure. The code includes functions for creating, modifying, and querying the map, as well as converting it to a list of key-value pairs. It also supports outputting the contents of the map in a human-readable format.

130

131 -- Bindings in right argument shadow those in the left

132 plusUFM :: UniqFM elt -> UniqFM elt -> UniqFM elt

133

134 plusUFM_C :: (elt -> elt -> elt)

139 intersectUFM :: UniqFM elt -> UniqFM elt -> UniqFM elt

140 intersectUFM_C :: (elt1 -> elt2 -> elt3)

141 -> UniqFM elt1 -> UniqFM elt2 -> UniqFM elt3

142

143 foldUFM :: (elt -> a -> a) -> a -> UniqFM elt -> a

148 filterUFM_Directly :: (Unique -> elt -> Bool) -> UniqFM elt -> UniqFM elt

149 partitionUFM :: (elt -> Bool) -> UniqFM elt -> (UniqFM elt, UniqFM elt)

150

151 sizeUFM :: UniqFM elt -> Int

154 elemUFM_Directly:: Unique -> UniqFM elt -> Bool

155

156 splitUFM :: Uniquable key => UniqFM elt -> key -> (UniqFM elt, Maybe elt, UniqFM elt)

157 -- Splits a UFM into things less than, equal to, and greater than the key

158 lookupUFM :: Uniquable key => UniqFM elt -> key -> Maybe elt

UniqSet.lhs (git://github.com/ilyasergey/GHC-XAppFix.git) Haskell · 123 lines

5 \section[UniqSet]{Specialised sets, for things with @Uniques@}

6

7 Based on @UniqFMs@ (as you would expect).

8

9 Basically, the things need to be in class @Uniquable@.

19 module UniqSet (

20 -- * Unique set type

21 UniqSet, -- type synonym for UniqFM a

22

23 -- ** Manipulating these sets

41 ) where

42

43 import UniqFM

44 import Unique

83 %************************************************************************

84 %* *

85 \subsection{Implementation using ``UniqFM''}

86 %* *

87 %************************************************************************

FV.hs (git://github.com/ghc/ghc.git) Haskell · 200 lines

27 ) where

28

29 import Var

30 import VarSet

37 -- ~~~~~~~~~~~~~~~~~~~~~~~

38 -- When computing free variables, the order in which you get them affects

39 -- the results of floating and specialization. If you use UniqFM to collect

40 -- them and then turn that into a list, you get them in nondeterministic

41 -- order as described in Note [Deterministic UniqFM] in UniqDFM.

42

43 -- A naive algorithm for free variables relies on merging sets of variables.

44 -- Merging costs O(n+m) for UniqFM and for UniqDFM there's an additional log

45 -- factor. It's cheaper to incrementally add to a list and use a set to check

46 -- for duplicates.

53 -- so that the list doesn't have duplicates

54 -- For explanation of why using `VarSet` is not deterministic see

55 -- Note [Deterministic UniqFM] in UniqDFM.

56 -> ([Var], VarSet)

57

FindSymbol.hs (https://github.com/hdevtools/hdevtools.git) Haskell · 96 lines

8 import GhcMonad (liftIO)

9 #elif __GLASGOW_HASKELL__ >= 710

10 import GHC.PackageDb (exposedName)

11 import GhcMonad (liftIO)

13 import Control.Applicative ((<$>))

14 import qualified UniqFM

15 #endif

16

17 import Control.Exception

18 import Control.Monad (filterM)

19 import Data.List (find, nub)

20 import Data.Maybe (catMaybes, isJust)

21 import Exception (ghandle)

22

23 import qualified GHC

24 import qualified Packages as PKG

NewRecordDelegate.java (http://mobiledatanow.googlecode.com/svn/trunk/) Java · 79 lines ✨ Summary

This Java class, NewRecordDelegate, is a delegate used by an MdnHtmlServlet to handle actions related to creating new records in a data view. It validates user state and menu action, creates a record for the data view if valid, sets it into the user state, and then delegates to another delegate (EditRecordDelegate) to show the created record.

6 package wsl.mdn.html;

7

8 import wsl.fw.servlet.ServletBase;

9 import wsl.fw.util.Util;

10 import wsl.fw.resource.ResId;

11 import wsl.mdn.guiconfig.*;

12 import wsl.mdn.dataview.*;

13

14 import java.io.IOException;

15 import javax.servlet.ServletException;

16

17 //------------------------------------------------------------------------------

MdnClientCell.java (http://mobiledatanow.googlecode.com/svn/trunk/) Java · 104 lines ✨ Summary

This Java class, MdnClientCell, extends the TD class from Apache ECS and represents a client cell element in HTML. It provides constructors for creating instances with different parameters, including a blank constructor, string constructor, boolean constructor, and an element constructor. The class also includes accessors to set and get the title and help URL of the client cell.

1 package wsl.mdn.html;

2

3 import org.apache.ecs.html.TD;

4 import org.apache.ecs.Element;

NamedNativeQuery.java (http://gwt-ent.googlecode.com/svn/trunk/) Java · 48 lines ✨ Summary

This Java code defines an annotation @NamedNativeQuery that can be applied to a type (e.g., class). It specifies metadata for a native query, including its name, query text, hints, result class, and optional resultSetMapping. The annotation is intended for use with the Java Persistence API (JPA) and has runtime retention, allowing it to be inspected at runtime.

25 package javax.persistence;

26

27 import java.lang.annotation.Target;

28 import java.lang.annotation.ElementType;

29 import java.lang.annotation.Retention;

30 import java.lang.annotation.RetentionPolicy;

AssemblyInfo.vb (https://cfx.svn.codeplex.com/svn) Visual Basic · 36 lines ✨ Summary

This Visual Basic code defines metadata for an assembly, including its title, company, and version information. It also specifies that the types in this assembly are not visible to COM components and provides a GUID for the typelib if the project is exposed to COM. The AssemblyVersion and AssemblyFileVersion values specify the version of the assembly.

1 Imports System.Reflection

2 Imports System.Runtime.InteropServices