Search is not available for this dataset
repo_name
string | path
string | license
string | full_code
string | full_size
int64 | uncommented_code
string | uncommented_size
int64 | function_only_code
string | function_only_size
int64 | is_commented
bool | is_signatured
bool | n_ast_errors
int64 | ast_max_depth
int64 | n_whitespaces
int64 | n_ast_nodes
int64 | n_ast_terminals
int64 | n_ast_nonterminals
int64 | loc
int64 | cycloplexity
int64 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
zc1036/Compiler-project | src/Analyzer.hs | gpl-3.0 | defaultSymTable :: SymbolTable
defaultSymTable = makeMap [("int", (Type intType, globalScope)),
("float", (Type floatType, globalScope)),
("char", (Type charType, globalScope)),
("void", (Type voidType, globalScope)),
("string", (Type stringType, globalScope)),
("null", (Variable nullType, globalScope))] | 440 | defaultSymTable :: SymbolTable
defaultSymTable = makeMap [("int", (Type intType, globalScope)),
("float", (Type floatType, globalScope)),
("char", (Type charType, globalScope)),
("void", (Type voidType, globalScope)),
("string", (Type stringType, globalScope)),
("null", (Variable nullType, globalScope))] | 440 | defaultSymTable = makeMap [("int", (Type intType, globalScope)),
("float", (Type floatType, globalScope)),
("char", (Type charType, globalScope)),
("void", (Type voidType, globalScope)),
("string", (Type stringType, globalScope)),
("null", (Variable nullType, globalScope))] | 409 | false | true | 0 | 9 | 164 | 122 | 73 | 49 | null | null |
CBMM/petersonfaces | petersonfaces-frontend/src/Canvas2D.hs | bsd-3-clause | save :: MonadIO m => CanvasRenderingContext2D -> m ()
save = error "save only available in ghcjs" | 97 | save :: MonadIO m => CanvasRenderingContext2D -> m ()
save = error "save only available in ghcjs" | 97 | save = error "save only available in ghcjs" | 43 | false | true | 0 | 9 | 16 | 36 | 15 | 21 | null | null |
ocharles/hadoom | hadoom/Hadoom/GL/World.hs | bsd-3-clause | compile :: PWorld l -> IO (GLInterpretation l)
compile (PWorld levelExpr) = go levelExpr
where go :: WorldExpr GLInterpretation t -> IO (GLInterpretation t)
go (Let bindings in_) =
go . in_ =<<
mfix (ttraverse go . bindings)
go (Var x) = return x
go (Vertex v) = return (GLVertex v)
go (Texture path colorSpace) =
GLTexture <$>
loadTexture path colorSpace
go (Hadoom.World.Material mkDiffuse mkNormals) =
GLMaterial <$>
(Material.Material <$>
((\(GLTexture t) -> t) <$>
go mkDiffuse) <*>
((\(Just (GLTexture t)) -> t) <$>
traverse go mkNormals))
go (World mkSectors mkWalls) =
do sectors <- traverse (go >=> \(GLSector s) -> return s) mkSectors
walls <- traverse (go >=> \(GLWall w) -> return w) mkWalls
return (GLWorld (CompiledWorld sectors walls))
go (Sector props mkVertices mkFloorMat mkCeilingMat) =
do
-- Realise all vertices
vertices <- map (\(GLVertex v) -> v) <$>
traverse go mkVertices
let floorVertices =
vertices <&>
\(P (V2 x y)) ->
GL.Vertex (realToFrac <$>
V3 x (sectorFloor props) y)
(V3 0 1 0)
(V3 1 0 0)
(V3 0 0 (-1))
(realToFrac <$>
(V2 x y ^*
recip textureSize))
ceilingVertices =
floorVertices <&>
\(GL.Vertex p n t bn uv) ->
GL.Vertex (p & _y .~
realToFrac (sectorCeiling props))
(negate n)
t
bn
uv
allVertices = floorVertices <> ceilingVertices
-- Allocate a vertex array object for the floor and ceiling
vao <- overPtr (glGenVertexArrays 1)
glBindVertexArray vao
-- Allocate a buffer for the vertex data.
vbo <- overPtr (glGenBuffers 1)
glBindBuffer GL_ARRAY_BUFFER vbo
glBufferData
GL_ARRAY_BUFFER
(fromIntegral
(sizeOf (undefined :: GL.Vertex) *
length allVertices))
nullPtr
GL_STATIC_DRAW
withArray allVertices
(glBufferSubData
GL_ARRAY_BUFFER
0
(fromIntegral
(sizeOf (undefined :: GL.Vertex) *
length allVertices)) .
castPtr)
GL.configureVertexAttributes
-- Build the element buffer
let floorIndices :: V.Vector GLuint
floorIndices =
fromIntegral <$>
triangulate (V.fromList vertices)
ceilingIndices =
let reverseTriangles v =
case V.splitAt 3 v of
(h,t)
| V.length h == 3 ->
V.fromList [h V.! 0,h V.! 2,h V.! 1] V.++
reverseTriangles t
_ -> mempty
in V.map (+ fromIntegral (length floorVertices))
(reverseTriangles floorIndices)
indices = floorIndices <> ceilingIndices
iboSize =
fromIntegral
(sizeOf (0 :: GLuint) *
V.length indices)
ibo <- overPtr (glGenBuffers 1)
glBindBuffer GL_ELEMENT_ARRAY_BUFFER ibo
glBufferData GL_ELEMENT_ARRAY_BUFFER iboSize nullPtr GL_STATIC_DRAW
SV.unsafeWith
(V.convert indices)
(glBufferSubData GL_ELEMENT_ARRAY_BUFFER 0 iboSize .
castPtr)
GLSector <$>
(CompiledSector
(do glBindVertexArray vao
glDrawElements GL_TRIANGLES
(fromIntegral (V.length floorIndices))
GL_UNSIGNED_INT
nullPtr)
(do glBindVertexArray vao
glDrawElements
GL_TRIANGLES
(fromIntegral (V.length ceilingIndices))
GL_UNSIGNED_INT
(nullPtr `plusPtr`
fromIntegral
(sizeOf (0 :: GLuint) *
V.length floorIndices))) <$>
((\(GLMaterial m) -> m) <$>
go mkFloorMat) <*>
((\(GLMaterial m) -> m) <$>
go mkCeilingMat) <*>
pure props)
go (Wall mkV1 mkV2 mkFrontFace mkBackFace) =
do
-- Allocate a vertex array object for this wall.
vao <- overPtr (glGenVertexArrays 1)
glBindVertexArray vao
-- Evaluate the start and end vertices, and the front and back sectors.
GLVertex v1 <- go mkV1
GLVertex v2 <- go mkV2
GLWallFace frontSector frontLowerMat frontUpperMat frontMidMat <- go mkFrontFace
mbackFace <- traverse go mkBackFace
-- We only draw the lower- or upper-front segments of a wall if the
-- back sector is visible.
let (drawLower,drawUpper) =
fromMaybe (False,False)
(do GLWallFace backSector _ _ _ <- mbackFace
return (sectorFloor (csProperties backSector) >
sectorFloor (csProperties frontSector)
,sectorCeiling (csProperties backSector) <
sectorCeiling (csProperties frontSector)))
-- Allocate a buffer for the vertex data.
vbo <- overPtr (glGenBuffers 1)
glBindBuffer GL_ARRAY_BUFFER vbo
glBufferData
GL_ARRAY_BUFFER
(fromIntegral
(sizeOf (undefined :: GL.Vertex) *
(4 +
(if drawLower
then 4
else 0) +
(if drawUpper
then 4
else 0))))
nullPtr
GL_STATIC_DRAW
-- Upload vertex data.
let wallV = v2 .-. v1
wallLen = norm wallV
frontHeight =
sectorCeiling (csProperties frontSector) -
sectorFloor (csProperties frontSector)
u =
realToFrac (wallLen / textureSize) :: CFloat
-- v =
-- realToFrac (frontHeight / textureSize) -- TODO Should depend on bottom/top in mkVertices
mkVertices bottom top =
getZipList
(GL.Vertex <$>
(fmap realToFrac <$>
ZipList [V3 (v1 ^. _x)
bottom
(v1 ^. _y)
,V3 (v2 ^. _x)
bottom
(v2 ^. _y)
,V3 (v2 ^. _x)
top
(v2 ^. _y)
,V3 (v1 ^. _x)
top
(v1 ^. _y)]) <*>
ZipList (repeat (normalize (case perp wallV of
V2 x y ->
realToFrac <$>
V3 x 0 y))) <*>
ZipList (repeat (normalize (case wallV of
V2 x y ->
realToFrac <$>
V3 x 0 y))) <*>
ZipList (repeat (V3 0 1 0)) <*>
ZipList [V2 u 1,V2 0 1,V2 0 0,V2 u 0])
-- -- Upload the main wall segment vertex data
let sizeOfWall =
4 *
fromIntegral (sizeOf (undefined :: GL.Vertex))
withArray (mkVertices
(case mbackFace of
Just (GLWallFace s _ _ _) ->
max (sectorFloor (csProperties frontSector))
(sectorFloor (csProperties s))
Nothing ->
sectorFloor (csProperties frontSector))
(case mbackFace of
Just (GLWallFace s _ _ _) ->
min (sectorCeiling (csProperties frontSector))
(sectorCeiling (csProperties s))
Nothing ->
sectorCeiling (csProperties frontSector)))
(glBufferSubData GL_ARRAY_BUFFER 0 sizeOfWall .
castPtr)
-- Upload the upper-front wall segment, if necessary.
for_ mbackFace $
\(GLWallFace backSector _ _ _) ->
when drawUpper
(withArray (mkVertices (sectorCeiling (csProperties backSector))
(sectorCeiling (csProperties frontSector)))
(glBufferSubData GL_ARRAY_BUFFER sizeOfWall sizeOfWall .
castPtr))
-- Upload the lower-front wall segment, if necessary.
for_ mbackFace $
\(GLWallFace back _ _ _) ->
when drawLower
(withArray (mkVertices (sectorFloor (csProperties frontSector))
(sectorFloor (csProperties back)))
(glBufferSubData
GL_ARRAY_BUFFER
(if drawUpper
then 2 * sizeOfWall
else sizeOfWall)
sizeOfWall .
castPtr))
GL.configureVertexAttributes
return
(GLWall (CompiledWall
(CompiledWallFace
((mbackFace >> frontLowerMat) <&>
(\mat ->
WallSegment
mat
(do glBindVertexArray vao
glDrawArrays
GL_TRIANGLE_FAN
(if drawUpper
then 8
else 4)
4)))
((mbackFace >> frontUpperMat) <&>
(\mat ->
WallSegment
mat
(do glBindVertexArray vao
glDrawArrays GL_TRIANGLE_FAN 4 4)))
(frontMidMat <&>
(\mat ->
WallSegment
mat
(do glBindVertexArray vao
glDrawArrays GL_TRIANGLE_FAN 0 4))))
Nothing))
go (WallFace s mkLower mkUpper mkMid) =
GLWallFace <$>
(go s >>= \(GLSector s) -> return s) <*>
traverse (go >=> \(GLMaterial m) -> return m) mkLower <*>
traverse (go >=> \(GLMaterial m) -> return m) mkUpper <*>
traverse (go >=> \(GLMaterial m) -> return m) mkMid | 12,595 | compile :: PWorld l -> IO (GLInterpretation l)
compile (PWorld levelExpr) = go levelExpr
where go :: WorldExpr GLInterpretation t -> IO (GLInterpretation t)
go (Let bindings in_) =
go . in_ =<<
mfix (ttraverse go . bindings)
go (Var x) = return x
go (Vertex v) = return (GLVertex v)
go (Texture path colorSpace) =
GLTexture <$>
loadTexture path colorSpace
go (Hadoom.World.Material mkDiffuse mkNormals) =
GLMaterial <$>
(Material.Material <$>
((\(GLTexture t) -> t) <$>
go mkDiffuse) <*>
((\(Just (GLTexture t)) -> t) <$>
traverse go mkNormals))
go (World mkSectors mkWalls) =
do sectors <- traverse (go >=> \(GLSector s) -> return s) mkSectors
walls <- traverse (go >=> \(GLWall w) -> return w) mkWalls
return (GLWorld (CompiledWorld sectors walls))
go (Sector props mkVertices mkFloorMat mkCeilingMat) =
do
-- Realise all vertices
vertices <- map (\(GLVertex v) -> v) <$>
traverse go mkVertices
let floorVertices =
vertices <&>
\(P (V2 x y)) ->
GL.Vertex (realToFrac <$>
V3 x (sectorFloor props) y)
(V3 0 1 0)
(V3 1 0 0)
(V3 0 0 (-1))
(realToFrac <$>
(V2 x y ^*
recip textureSize))
ceilingVertices =
floorVertices <&>
\(GL.Vertex p n t bn uv) ->
GL.Vertex (p & _y .~
realToFrac (sectorCeiling props))
(negate n)
t
bn
uv
allVertices = floorVertices <> ceilingVertices
-- Allocate a vertex array object for the floor and ceiling
vao <- overPtr (glGenVertexArrays 1)
glBindVertexArray vao
-- Allocate a buffer for the vertex data.
vbo <- overPtr (glGenBuffers 1)
glBindBuffer GL_ARRAY_BUFFER vbo
glBufferData
GL_ARRAY_BUFFER
(fromIntegral
(sizeOf (undefined :: GL.Vertex) *
length allVertices))
nullPtr
GL_STATIC_DRAW
withArray allVertices
(glBufferSubData
GL_ARRAY_BUFFER
0
(fromIntegral
(sizeOf (undefined :: GL.Vertex) *
length allVertices)) .
castPtr)
GL.configureVertexAttributes
-- Build the element buffer
let floorIndices :: V.Vector GLuint
floorIndices =
fromIntegral <$>
triangulate (V.fromList vertices)
ceilingIndices =
let reverseTriangles v =
case V.splitAt 3 v of
(h,t)
| V.length h == 3 ->
V.fromList [h V.! 0,h V.! 2,h V.! 1] V.++
reverseTriangles t
_ -> mempty
in V.map (+ fromIntegral (length floorVertices))
(reverseTriangles floorIndices)
indices = floorIndices <> ceilingIndices
iboSize =
fromIntegral
(sizeOf (0 :: GLuint) *
V.length indices)
ibo <- overPtr (glGenBuffers 1)
glBindBuffer GL_ELEMENT_ARRAY_BUFFER ibo
glBufferData GL_ELEMENT_ARRAY_BUFFER iboSize nullPtr GL_STATIC_DRAW
SV.unsafeWith
(V.convert indices)
(glBufferSubData GL_ELEMENT_ARRAY_BUFFER 0 iboSize .
castPtr)
GLSector <$>
(CompiledSector
(do glBindVertexArray vao
glDrawElements GL_TRIANGLES
(fromIntegral (V.length floorIndices))
GL_UNSIGNED_INT
nullPtr)
(do glBindVertexArray vao
glDrawElements
GL_TRIANGLES
(fromIntegral (V.length ceilingIndices))
GL_UNSIGNED_INT
(nullPtr `plusPtr`
fromIntegral
(sizeOf (0 :: GLuint) *
V.length floorIndices))) <$>
((\(GLMaterial m) -> m) <$>
go mkFloorMat) <*>
((\(GLMaterial m) -> m) <$>
go mkCeilingMat) <*>
pure props)
go (Wall mkV1 mkV2 mkFrontFace mkBackFace) =
do
-- Allocate a vertex array object for this wall.
vao <- overPtr (glGenVertexArrays 1)
glBindVertexArray vao
-- Evaluate the start and end vertices, and the front and back sectors.
GLVertex v1 <- go mkV1
GLVertex v2 <- go mkV2
GLWallFace frontSector frontLowerMat frontUpperMat frontMidMat <- go mkFrontFace
mbackFace <- traverse go mkBackFace
-- We only draw the lower- or upper-front segments of a wall if the
-- back sector is visible.
let (drawLower,drawUpper) =
fromMaybe (False,False)
(do GLWallFace backSector _ _ _ <- mbackFace
return (sectorFloor (csProperties backSector) >
sectorFloor (csProperties frontSector)
,sectorCeiling (csProperties backSector) <
sectorCeiling (csProperties frontSector)))
-- Allocate a buffer for the vertex data.
vbo <- overPtr (glGenBuffers 1)
glBindBuffer GL_ARRAY_BUFFER vbo
glBufferData
GL_ARRAY_BUFFER
(fromIntegral
(sizeOf (undefined :: GL.Vertex) *
(4 +
(if drawLower
then 4
else 0) +
(if drawUpper
then 4
else 0))))
nullPtr
GL_STATIC_DRAW
-- Upload vertex data.
let wallV = v2 .-. v1
wallLen = norm wallV
frontHeight =
sectorCeiling (csProperties frontSector) -
sectorFloor (csProperties frontSector)
u =
realToFrac (wallLen / textureSize) :: CFloat
-- v =
-- realToFrac (frontHeight / textureSize) -- TODO Should depend on bottom/top in mkVertices
mkVertices bottom top =
getZipList
(GL.Vertex <$>
(fmap realToFrac <$>
ZipList [V3 (v1 ^. _x)
bottom
(v1 ^. _y)
,V3 (v2 ^. _x)
bottom
(v2 ^. _y)
,V3 (v2 ^. _x)
top
(v2 ^. _y)
,V3 (v1 ^. _x)
top
(v1 ^. _y)]) <*>
ZipList (repeat (normalize (case perp wallV of
V2 x y ->
realToFrac <$>
V3 x 0 y))) <*>
ZipList (repeat (normalize (case wallV of
V2 x y ->
realToFrac <$>
V3 x 0 y))) <*>
ZipList (repeat (V3 0 1 0)) <*>
ZipList [V2 u 1,V2 0 1,V2 0 0,V2 u 0])
-- -- Upload the main wall segment vertex data
let sizeOfWall =
4 *
fromIntegral (sizeOf (undefined :: GL.Vertex))
withArray (mkVertices
(case mbackFace of
Just (GLWallFace s _ _ _) ->
max (sectorFloor (csProperties frontSector))
(sectorFloor (csProperties s))
Nothing ->
sectorFloor (csProperties frontSector))
(case mbackFace of
Just (GLWallFace s _ _ _) ->
min (sectorCeiling (csProperties frontSector))
(sectorCeiling (csProperties s))
Nothing ->
sectorCeiling (csProperties frontSector)))
(glBufferSubData GL_ARRAY_BUFFER 0 sizeOfWall .
castPtr)
-- Upload the upper-front wall segment, if necessary.
for_ mbackFace $
\(GLWallFace backSector _ _ _) ->
when drawUpper
(withArray (mkVertices (sectorCeiling (csProperties backSector))
(sectorCeiling (csProperties frontSector)))
(glBufferSubData GL_ARRAY_BUFFER sizeOfWall sizeOfWall .
castPtr))
-- Upload the lower-front wall segment, if necessary.
for_ mbackFace $
\(GLWallFace back _ _ _) ->
when drawLower
(withArray (mkVertices (sectorFloor (csProperties frontSector))
(sectorFloor (csProperties back)))
(glBufferSubData
GL_ARRAY_BUFFER
(if drawUpper
then 2 * sizeOfWall
else sizeOfWall)
sizeOfWall .
castPtr))
GL.configureVertexAttributes
return
(GLWall (CompiledWall
(CompiledWallFace
((mbackFace >> frontLowerMat) <&>
(\mat ->
WallSegment
mat
(do glBindVertexArray vao
glDrawArrays
GL_TRIANGLE_FAN
(if drawUpper
then 8
else 4)
4)))
((mbackFace >> frontUpperMat) <&>
(\mat ->
WallSegment
mat
(do glBindVertexArray vao
glDrawArrays GL_TRIANGLE_FAN 4 4)))
(frontMidMat <&>
(\mat ->
WallSegment
mat
(do glBindVertexArray vao
glDrawArrays GL_TRIANGLE_FAN 0 4))))
Nothing))
go (WallFace s mkLower mkUpper mkMid) =
GLWallFace <$>
(go s >>= \(GLSector s) -> return s) <*>
traverse (go >=> \(GLMaterial m) -> return m) mkLower <*>
traverse (go >=> \(GLMaterial m) -> return m) mkUpper <*>
traverse (go >=> \(GLMaterial m) -> return m) mkMid | 12,595 | compile (PWorld levelExpr) = go levelExpr
where go :: WorldExpr GLInterpretation t -> IO (GLInterpretation t)
go (Let bindings in_) =
go . in_ =<<
mfix (ttraverse go . bindings)
go (Var x) = return x
go (Vertex v) = return (GLVertex v)
go (Texture path colorSpace) =
GLTexture <$>
loadTexture path colorSpace
go (Hadoom.World.Material mkDiffuse mkNormals) =
GLMaterial <$>
(Material.Material <$>
((\(GLTexture t) -> t) <$>
go mkDiffuse) <*>
((\(Just (GLTexture t)) -> t) <$>
traverse go mkNormals))
go (World mkSectors mkWalls) =
do sectors <- traverse (go >=> \(GLSector s) -> return s) mkSectors
walls <- traverse (go >=> \(GLWall w) -> return w) mkWalls
return (GLWorld (CompiledWorld sectors walls))
go (Sector props mkVertices mkFloorMat mkCeilingMat) =
do
-- Realise all vertices
vertices <- map (\(GLVertex v) -> v) <$>
traverse go mkVertices
let floorVertices =
vertices <&>
\(P (V2 x y)) ->
GL.Vertex (realToFrac <$>
V3 x (sectorFloor props) y)
(V3 0 1 0)
(V3 1 0 0)
(V3 0 0 (-1))
(realToFrac <$>
(V2 x y ^*
recip textureSize))
ceilingVertices =
floorVertices <&>
\(GL.Vertex p n t bn uv) ->
GL.Vertex (p & _y .~
realToFrac (sectorCeiling props))
(negate n)
t
bn
uv
allVertices = floorVertices <> ceilingVertices
-- Allocate a vertex array object for the floor and ceiling
vao <- overPtr (glGenVertexArrays 1)
glBindVertexArray vao
-- Allocate a buffer for the vertex data.
vbo <- overPtr (glGenBuffers 1)
glBindBuffer GL_ARRAY_BUFFER vbo
glBufferData
GL_ARRAY_BUFFER
(fromIntegral
(sizeOf (undefined :: GL.Vertex) *
length allVertices))
nullPtr
GL_STATIC_DRAW
withArray allVertices
(glBufferSubData
GL_ARRAY_BUFFER
0
(fromIntegral
(sizeOf (undefined :: GL.Vertex) *
length allVertices)) .
castPtr)
GL.configureVertexAttributes
-- Build the element buffer
let floorIndices :: V.Vector GLuint
floorIndices =
fromIntegral <$>
triangulate (V.fromList vertices)
ceilingIndices =
let reverseTriangles v =
case V.splitAt 3 v of
(h,t)
| V.length h == 3 ->
V.fromList [h V.! 0,h V.! 2,h V.! 1] V.++
reverseTriangles t
_ -> mempty
in V.map (+ fromIntegral (length floorVertices))
(reverseTriangles floorIndices)
indices = floorIndices <> ceilingIndices
iboSize =
fromIntegral
(sizeOf (0 :: GLuint) *
V.length indices)
ibo <- overPtr (glGenBuffers 1)
glBindBuffer GL_ELEMENT_ARRAY_BUFFER ibo
glBufferData GL_ELEMENT_ARRAY_BUFFER iboSize nullPtr GL_STATIC_DRAW
SV.unsafeWith
(V.convert indices)
(glBufferSubData GL_ELEMENT_ARRAY_BUFFER 0 iboSize .
castPtr)
GLSector <$>
(CompiledSector
(do glBindVertexArray vao
glDrawElements GL_TRIANGLES
(fromIntegral (V.length floorIndices))
GL_UNSIGNED_INT
nullPtr)
(do glBindVertexArray vao
glDrawElements
GL_TRIANGLES
(fromIntegral (V.length ceilingIndices))
GL_UNSIGNED_INT
(nullPtr `plusPtr`
fromIntegral
(sizeOf (0 :: GLuint) *
V.length floorIndices))) <$>
((\(GLMaterial m) -> m) <$>
go mkFloorMat) <*>
((\(GLMaterial m) -> m) <$>
go mkCeilingMat) <*>
pure props)
go (Wall mkV1 mkV2 mkFrontFace mkBackFace) =
do
-- Allocate a vertex array object for this wall.
vao <- overPtr (glGenVertexArrays 1)
glBindVertexArray vao
-- Evaluate the start and end vertices, and the front and back sectors.
GLVertex v1 <- go mkV1
GLVertex v2 <- go mkV2
GLWallFace frontSector frontLowerMat frontUpperMat frontMidMat <- go mkFrontFace
mbackFace <- traverse go mkBackFace
-- We only draw the lower- or upper-front segments of a wall if the
-- back sector is visible.
let (drawLower,drawUpper) =
fromMaybe (False,False)
(do GLWallFace backSector _ _ _ <- mbackFace
return (sectorFloor (csProperties backSector) >
sectorFloor (csProperties frontSector)
,sectorCeiling (csProperties backSector) <
sectorCeiling (csProperties frontSector)))
-- Allocate a buffer for the vertex data.
vbo <- overPtr (glGenBuffers 1)
glBindBuffer GL_ARRAY_BUFFER vbo
glBufferData
GL_ARRAY_BUFFER
(fromIntegral
(sizeOf (undefined :: GL.Vertex) *
(4 +
(if drawLower
then 4
else 0) +
(if drawUpper
then 4
else 0))))
nullPtr
GL_STATIC_DRAW
-- Upload vertex data.
let wallV = v2 .-. v1
wallLen = norm wallV
frontHeight =
sectorCeiling (csProperties frontSector) -
sectorFloor (csProperties frontSector)
u =
realToFrac (wallLen / textureSize) :: CFloat
-- v =
-- realToFrac (frontHeight / textureSize) -- TODO Should depend on bottom/top in mkVertices
mkVertices bottom top =
getZipList
(GL.Vertex <$>
(fmap realToFrac <$>
ZipList [V3 (v1 ^. _x)
bottom
(v1 ^. _y)
,V3 (v2 ^. _x)
bottom
(v2 ^. _y)
,V3 (v2 ^. _x)
top
(v2 ^. _y)
,V3 (v1 ^. _x)
top
(v1 ^. _y)]) <*>
ZipList (repeat (normalize (case perp wallV of
V2 x y ->
realToFrac <$>
V3 x 0 y))) <*>
ZipList (repeat (normalize (case wallV of
V2 x y ->
realToFrac <$>
V3 x 0 y))) <*>
ZipList (repeat (V3 0 1 0)) <*>
ZipList [V2 u 1,V2 0 1,V2 0 0,V2 u 0])
-- -- Upload the main wall segment vertex data
let sizeOfWall =
4 *
fromIntegral (sizeOf (undefined :: GL.Vertex))
withArray (mkVertices
(case mbackFace of
Just (GLWallFace s _ _ _) ->
max (sectorFloor (csProperties frontSector))
(sectorFloor (csProperties s))
Nothing ->
sectorFloor (csProperties frontSector))
(case mbackFace of
Just (GLWallFace s _ _ _) ->
min (sectorCeiling (csProperties frontSector))
(sectorCeiling (csProperties s))
Nothing ->
sectorCeiling (csProperties frontSector)))
(glBufferSubData GL_ARRAY_BUFFER 0 sizeOfWall .
castPtr)
-- Upload the upper-front wall segment, if necessary.
for_ mbackFace $
\(GLWallFace backSector _ _ _) ->
when drawUpper
(withArray (mkVertices (sectorCeiling (csProperties backSector))
(sectorCeiling (csProperties frontSector)))
(glBufferSubData GL_ARRAY_BUFFER sizeOfWall sizeOfWall .
castPtr))
-- Upload the lower-front wall segment, if necessary.
for_ mbackFace $
\(GLWallFace back _ _ _) ->
when drawLower
(withArray (mkVertices (sectorFloor (csProperties frontSector))
(sectorFloor (csProperties back)))
(glBufferSubData
GL_ARRAY_BUFFER
(if drawUpper
then 2 * sizeOfWall
else sizeOfWall)
sizeOfWall .
castPtr))
GL.configureVertexAttributes
return
(GLWall (CompiledWall
(CompiledWallFace
((mbackFace >> frontLowerMat) <&>
(\mat ->
WallSegment
mat
(do glBindVertexArray vao
glDrawArrays
GL_TRIANGLE_FAN
(if drawUpper
then 8
else 4)
4)))
((mbackFace >> frontUpperMat) <&>
(\mat ->
WallSegment
mat
(do glBindVertexArray vao
glDrawArrays GL_TRIANGLE_FAN 4 4)))
(frontMidMat <&>
(\mat ->
WallSegment
mat
(do glBindVertexArray vao
glDrawArrays GL_TRIANGLE_FAN 0 4))))
Nothing))
go (WallFace s mkLower mkUpper mkMid) =
GLWallFace <$>
(go s >>= \(GLSector s) -> return s) <*>
traverse (go >=> \(GLMaterial m) -> return m) mkLower <*>
traverse (go >=> \(GLMaterial m) -> return m) mkUpper <*>
traverse (go >=> \(GLMaterial m) -> return m) mkMid | 12,548 | false | true | 10 | 32 | 6,909 | 2,574 | 1,270 | 1,304 | null | null |
LudvikGalois/USBGame | src/Main.hs | mit | handleEvent (KeyboardEvent _ _ _ s r k) = do
use windowSurf >>= (liftIO . \s -> (fillRect s nullPtr 0xffabcdef))
return () | 126 | handleEvent (KeyboardEvent _ _ _ s r k) = do
use windowSurf >>= (liftIO . \s -> (fillRect s nullPtr 0xffabcdef))
return () | 126 | handleEvent (KeyboardEvent _ _ _ s r k) = do
use windowSurf >>= (liftIO . \s -> (fillRect s nullPtr 0xffabcdef))
return () | 126 | false | false | 0 | 12 | 26 | 65 | 31 | 34 | null | null |
gamelost/pcgen-rules | src/Bonus.hs | apache-2.0 | parseBonusFeat :: PParser Formula
parseBonusFeat = bonusTag "FEAT|POOL" >> parseFormula | 87 | parseBonusFeat :: PParser Formula
parseBonusFeat = bonusTag "FEAT|POOL" >> parseFormula | 87 | parseBonusFeat = bonusTag "FEAT|POOL" >> parseFormula | 53 | false | true | 0 | 6 | 9 | 21 | 10 | 11 | null | null |
AshyIsMe/lambdatwit | Main.hs | mit | evalExpr :: String -> IO String
evalExpr e =
case getOptions ["--expression", e] of
Left t@(b, e) -> return $ show t
Right opts -> do
r <- runInterpreter (interpreter opts)
case r of
Left err -> return $ show err
Right (e,et,val) -> do (out, b) <- getResult val
return out | 379 | evalExpr :: String -> IO String
evalExpr e =
case getOptions ["--expression", e] of
Left t@(b, e) -> return $ show t
Right opts -> do
r <- runInterpreter (interpreter opts)
case r of
Left err -> return $ show err
Right (e,et,val) -> do (out, b) <- getResult val
return out | 379 | evalExpr e =
case getOptions ["--expression", e] of
Left t@(b, e) -> return $ show t
Right opts -> do
r <- runInterpreter (interpreter opts)
case r of
Left err -> return $ show err
Right (e,et,val) -> do (out, b) <- getResult val
return out | 347 | false | true | 0 | 16 | 158 | 147 | 71 | 76 | null | null |
Gonzih/hayoo-cli | Main.hs | mit | printResponse (Opts True _) HayooResponse{ result = (res:_) } = printResultFull res | 84 | printResponse (Opts True _) HayooResponse{ result = (res:_) } = printResultFull res | 84 | printResponse (Opts True _) HayooResponse{ result = (res:_) } = printResultFull res | 84 | false | false | 1 | 9 | 12 | 39 | 19 | 20 | null | null |
slcz/gomoku | src/Ai.hs | apache-2.0 | generateScanList :: Dimension -> [Scan]
generateScanList d = zipWith build [hScan, vScan, diagRScan, diagLScan]
[hIdx, vIdx, diagRIdx, diagLIdx ] where
build x y = Scan (fromList $ map fromList x) y
(h', w', w) = (snd d, fst d, wi d)
hScan = map (\x -> take w' $ iterate (+1) $ x * w + w') [0..h'-1]
vScan = map (\x -> take h' $ iterate (+w) $ x + w') [0..w'-1]
diagRScan = genDscan diagRClip (+1) (+(w+1))
diagLScan = genDscan diagLClip (+w') (+(w-1))
src = [0 .. w' + w' - 1] :: [Int]
drophead f = map drop (f [0..w'-1])
droptail f = map take (f [1..w'-1])
diagRClip = drophead reverse ++ droptail reverse
diagLClip = droptail id ++ drophead id
genDscan clip offset stride = zipWith id clip $ map genDiag src where
genDiag = take w'. iterate stride . offset
hIdx = (`div` w)
vIdx = (\x -> x `mod` w - w')
diagRIdx x = x `mod` (w + 1) - 1
diagLIdx x = x `mod` (w - 1) - w' | 1,007 | generateScanList :: Dimension -> [Scan]
generateScanList d = zipWith build [hScan, vScan, diagRScan, diagLScan]
[hIdx, vIdx, diagRIdx, diagLIdx ] where
build x y = Scan (fromList $ map fromList x) y
(h', w', w) = (snd d, fst d, wi d)
hScan = map (\x -> take w' $ iterate (+1) $ x * w + w') [0..h'-1]
vScan = map (\x -> take h' $ iterate (+w) $ x + w') [0..w'-1]
diagRScan = genDscan diagRClip (+1) (+(w+1))
diagLScan = genDscan diagLClip (+w') (+(w-1))
src = [0 .. w' + w' - 1] :: [Int]
drophead f = map drop (f [0..w'-1])
droptail f = map take (f [1..w'-1])
diagRClip = drophead reverse ++ droptail reverse
diagLClip = droptail id ++ drophead id
genDscan clip offset stride = zipWith id clip $ map genDiag src where
genDiag = take w'. iterate stride . offset
hIdx = (`div` w)
vIdx = (\x -> x `mod` w - w')
diagRIdx x = x `mod` (w + 1) - 1
diagLIdx x = x `mod` (w - 1) - w' | 1,007 | generateScanList d = zipWith build [hScan, vScan, diagRScan, diagLScan]
[hIdx, vIdx, diagRIdx, diagLIdx ] where
build x y = Scan (fromList $ map fromList x) y
(h', w', w) = (snd d, fst d, wi d)
hScan = map (\x -> take w' $ iterate (+1) $ x * w + w') [0..h'-1]
vScan = map (\x -> take h' $ iterate (+w) $ x + w') [0..w'-1]
diagRScan = genDscan diagRClip (+1) (+(w+1))
diagLScan = genDscan diagLClip (+w') (+(w-1))
src = [0 .. w' + w' - 1] :: [Int]
drophead f = map drop (f [0..w'-1])
droptail f = map take (f [1..w'-1])
diagRClip = drophead reverse ++ droptail reverse
diagLClip = droptail id ++ drophead id
genDscan clip offset stride = zipWith id clip $ map genDiag src where
genDiag = take w'. iterate stride . offset
hIdx = (`div` w)
vIdx = (\x -> x `mod` w - w')
diagRIdx x = x `mod` (w + 1) - 1
diagLIdx x = x `mod` (w - 1) - w' | 967 | false | true | 14 | 13 | 311 | 572 | 281 | 291 | null | null |
ducis/haAni | hs/common/Graphics/UI/GLUT/GameMode.hs | gpl-2.0 | --------------------------------------------------------------------------------
-- | Return 'Just' the mode which would be tried by the next call to
-- 'enterGameMode'. Returns 'Nothing' if the mode requested by the current value
-- of 'gameModeCapabilities' is not possible, in which case 'enterGameMode'
-- would simply create a full screen window using the current mode.
gameModeInfo :: GettableStateVar (Maybe GameModeInfo)
gameModeInfo = makeGettableStateVar $ do
possible <- getBool glut_GAME_MODE_POSSIBLE
if possible
then do
w <- glutGameModeGet glut_GAME_MODE_WIDTH
h <- glutGameModeGet glut_GAME_MODE_HEIGHT
let size = Size (fromIntegral w) (fromIntegral h)
b <- glutGameModeGet glut_GAME_MODE_PIXEL_DEPTH
r <- glutGameModeGet glut_GAME_MODE_REFRESH_RATE
return $ Just $ GameModeInfo size (fromIntegral b) (fromIntegral r)
else return Nothing | 927 | gameModeInfo :: GettableStateVar (Maybe GameModeInfo)
gameModeInfo = makeGettableStateVar $ do
possible <- getBool glut_GAME_MODE_POSSIBLE
if possible
then do
w <- glutGameModeGet glut_GAME_MODE_WIDTH
h <- glutGameModeGet glut_GAME_MODE_HEIGHT
let size = Size (fromIntegral w) (fromIntegral h)
b <- glutGameModeGet glut_GAME_MODE_PIXEL_DEPTH
r <- glutGameModeGet glut_GAME_MODE_REFRESH_RATE
return $ Just $ GameModeInfo size (fromIntegral b) (fromIntegral r)
else return Nothing | 550 | gameModeInfo = makeGettableStateVar $ do
possible <- getBool glut_GAME_MODE_POSSIBLE
if possible
then do
w <- glutGameModeGet glut_GAME_MODE_WIDTH
h <- glutGameModeGet glut_GAME_MODE_HEIGHT
let size = Size (fromIntegral w) (fromIntegral h)
b <- glutGameModeGet glut_GAME_MODE_PIXEL_DEPTH
r <- glutGameModeGet glut_GAME_MODE_REFRESH_RATE
return $ Just $ GameModeInfo size (fromIntegral b) (fromIntegral r)
else return Nothing | 496 | true | true | 0 | 16 | 178 | 149 | 70 | 79 | null | null |
kajigor/uKanren_transformations | src/TaglessFinal/EvalState.hs | bsd-3-clause | updateSubst :: (Subst.Subst Var -> Subst.Subst Var) -> State EvalState (Subst.Subst Var)
updateSubst f = do
state <- get
let varState = getVarState state
let newSubst = f (getSubst state)
put $ EvalState { getVarState = varState, getSubst = newSubst }
return newSubst | 277 | updateSubst :: (Subst.Subst Var -> Subst.Subst Var) -> State EvalState (Subst.Subst Var)
updateSubst f = do
state <- get
let varState = getVarState state
let newSubst = f (getSubst state)
put $ EvalState { getVarState = varState, getSubst = newSubst }
return newSubst | 277 | updateSubst f = do
state <- get
let varState = getVarState state
let newSubst = f (getSubst state)
put $ EvalState { getVarState = varState, getSubst = newSubst }
return newSubst | 188 | false | true | 0 | 12 | 52 | 112 | 53 | 59 | null | null |
frontrowed/esqueleto | src/Database/Esqueleto/Internal/Sql.hs | bsd-3-clause | from5P :: Proxy (a,b,c,d,e) -> Proxy ((a,b),(c,d),e)
from5P = const Proxy | 73 | from5P :: Proxy (a,b,c,d,e) -> Proxy ((a,b),(c,d),e)
from5P = const Proxy | 73 | from5P = const Proxy | 20 | false | true | 0 | 8 | 10 | 60 | 35 | 25 | null | null |
kim/amazonka | amazonka-ec2/gen/Network/AWS/EC2/Types.hs | mpl-2.0 | -- | 'InstanceNetworkInterfaceAttachment' constructor.
--
-- The fields accessible through corresponding lenses are:
--
-- * 'iniaAttachTime' @::@ 'Maybe' 'UTCTime'
--
-- * 'iniaAttachmentId' @::@ 'Maybe' 'Text'
--
-- * 'iniaDeleteOnTermination' @::@ 'Maybe' 'Bool'
--
-- * 'iniaDeviceIndex' @::@ 'Maybe' 'Int'
--
-- * 'iniaStatus' @::@ 'Maybe' 'AttachmentStatus'
--
instanceNetworkInterfaceAttachment :: InstanceNetworkInterfaceAttachment
instanceNetworkInterfaceAttachment = InstanceNetworkInterfaceAttachment
{ _iniaAttachmentId = Nothing
, _iniaDeviceIndex = Nothing
, _iniaStatus = Nothing
, _iniaAttachTime = Nothing
, _iniaDeleteOnTermination = Nothing
} | 722 | instanceNetworkInterfaceAttachment :: InstanceNetworkInterfaceAttachment
instanceNetworkInterfaceAttachment = InstanceNetworkInterfaceAttachment
{ _iniaAttachmentId = Nothing
, _iniaDeviceIndex = Nothing
, _iniaStatus = Nothing
, _iniaAttachTime = Nothing
, _iniaDeleteOnTermination = Nothing
} | 355 | instanceNetworkInterfaceAttachment = InstanceNetworkInterfaceAttachment
{ _iniaAttachmentId = Nothing
, _iniaDeviceIndex = Nothing
, _iniaStatus = Nothing
, _iniaAttachTime = Nothing
, _iniaDeleteOnTermination = Nothing
} | 282 | true | true | 0 | 7 | 136 | 67 | 43 | 24 | null | null |
lambda-11235/pure-hlisp | src/Parse.hs | gpl-2.0 | -- | Parses a string into a series of list objects.
lispParse :: Parser a -> String -> [LexOut] -> Either ParseError a
lispParse p name toks = runParser (p <* eof) () name toks | 176 | lispParse :: Parser a -> String -> [LexOut] -> Either ParseError a
lispParse p name toks = runParser (p <* eof) () name toks | 124 | lispParse p name toks = runParser (p <* eof) () name toks | 57 | true | true | 0 | 8 | 34 | 60 | 30 | 30 | null | null |
acowley/roshask | src/Ros/Internal/DepFinder.hs | bsd-3-clause | catkinBuildDeps :: String -> Maybe [Package]
catkinBuildDeps = fmap (map strContent . findChildren dep) . parseXMLDoc
where dep = QName "build_depend" Nothing Nothing
-- The given path is a possible package path root, as are all of its
-- subdirectories that are stacks (indicated by the presence of a
-- stack.xml file). Returns a list of package directories. | 363 | catkinBuildDeps :: String -> Maybe [Package]
catkinBuildDeps = fmap (map strContent . findChildren dep) . parseXMLDoc
where dep = QName "build_depend" Nothing Nothing
-- The given path is a possible package path root, as are all of its
-- subdirectories that are stacks (indicated by the presence of a
-- stack.xml file). Returns a list of package directories. | 363 | catkinBuildDeps = fmap (map strContent . findChildren dep) . parseXMLDoc
where dep = QName "build_depend" Nothing Nothing
-- The given path is a possible package path root, as are all of its
-- subdirectories that are stacks (indicated by the presence of a
-- stack.xml file). Returns a list of package directories. | 318 | false | true | 0 | 9 | 60 | 59 | 30 | 29 | null | null |
vikraman/ghc | compiler/typecheck/TcType.hs | bsd-3-clause | isCharTy = is_tc charTyConKey | 35 | isCharTy = is_tc charTyConKey | 35 | isCharTy = is_tc charTyConKey | 35 | false | false | 1 | 5 | 9 | 13 | 4 | 9 | null | null |
sdiehl/ghc | compiler/deSugar/Coverage.hs | bsd-3-clause | addTickHsExpr (HsPragE _ HsPragTick{} (L pos e0)) = do
e2 <- allocTickBox (ExpBox False) False False pos $
addTickHsExpr e0
return $ unLoc e2 | 165 | addTickHsExpr (HsPragE _ HsPragTick{} (L pos e0)) = do
e2 <- allocTickBox (ExpBox False) False False pos $
addTickHsExpr e0
return $ unLoc e2 | 165 | addTickHsExpr (HsPragE _ HsPragTick{} (L pos e0)) = do
e2 <- allocTickBox (ExpBox False) False False pos $
addTickHsExpr e0
return $ unLoc e2 | 165 | false | false | 0 | 11 | 47 | 70 | 32 | 38 | null | null |
diminishedprime/.org | reading-list/haskell_programming_from_first_principles/11_05.hs | mit | doge = Plane PapuAir | 20 | doge = Plane PapuAir | 20 | doge = Plane PapuAir | 20 | false | false | 1 | 5 | 3 | 12 | 4 | 8 | null | null |
caasi/spj-book-student-1992 | src/TiState.hs | bsd-3-clause | primitives :: ASSOC Name Primitive
primitives = [ ("negate", Neg)
, ("+", Add), ("-", Sub)
, ("*", Mul), ("/", Div)
, ("if", If)
, (">", Greater)
, (">=", GreaterEq)
, ("<", Less)
, ("<=", LessEq)
, ("==", Eq)
, ("~=", NotEq)
, ("casePair", PrimCasePair)
, ("caseList", PrimCaseList)
, ("abort", Abort)
, ("print", Print)
, ("stop", Stop)
] | 535 | primitives :: ASSOC Name Primitive
primitives = [ ("negate", Neg)
, ("+", Add), ("-", Sub)
, ("*", Mul), ("/", Div)
, ("if", If)
, (">", Greater)
, (">=", GreaterEq)
, ("<", Less)
, ("<=", LessEq)
, ("==", Eq)
, ("~=", NotEq)
, ("casePair", PrimCasePair)
, ("caseList", PrimCaseList)
, ("abort", Abort)
, ("print", Print)
, ("stop", Stop)
] | 535 | primitives = [ ("negate", Neg)
, ("+", Add), ("-", Sub)
, ("*", Mul), ("/", Div)
, ("if", If)
, (">", Greater)
, (">=", GreaterEq)
, ("<", Less)
, ("<=", LessEq)
, ("==", Eq)
, ("~=", NotEq)
, ("casePair", PrimCasePair)
, ("caseList", PrimCaseList)
, ("abort", Abort)
, ("print", Print)
, ("stop", Stop)
] | 500 | false | true | 1 | 7 | 251 | 173 | 110 | 63 | null | null |
forked-upstream-packages-for-ghcjs/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | int16TyConKey = mkPreludeTyConUnique 17 | 65 | int16TyConKey = mkPreludeTyConUnique 17 | 65 | int16TyConKey = mkPreludeTyConUnique 17 | 65 | false | false | 0 | 5 | 29 | 9 | 4 | 5 | null | null |
alexander-at-github/eta | compiler/ETA/DeSugar/DsArrows.hs | bsd-3-clause | collectPatsBinders :: [LPat Id] -> [Id]
collectPatsBinders pats = foldr collectl [] pats | 88 | collectPatsBinders :: [LPat Id] -> [Id]
collectPatsBinders pats = foldr collectl [] pats | 88 | collectPatsBinders pats = foldr collectl [] pats | 48 | false | true | 0 | 8 | 12 | 41 | 19 | 22 | null | null |
gorkinovich/Haskell | Others/Fibonacci.hs | mit | heavyFibonacci 1 = 1 | 20 | heavyFibonacci 1 = 1 | 20 | heavyFibonacci 1 = 1 | 20 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
thoughtpolice/vacuum | src/GHC/Vacuum/Types.hs | lgpl-3.0 | nodeMod = snd3 . itabName . nodeInfo | 38 | nodeMod = snd3 . itabName . nodeInfo | 38 | nodeMod = snd3 . itabName . nodeInfo | 38 | false | false | 2 | 5 | 8 | 18 | 7 | 11 | null | null |
snowmantw/Frag | src/PhysicalDimensions.hs | gpl-2.0 | -- The resulting heading is in the interval [-pi, pi).
normalizeHeading :: Heading -> Heading
normalizeHeading = normalizeAngle | 128 | normalizeHeading :: Heading -> Heading
normalizeHeading = normalizeAngle | 73 | normalizeHeading = normalizeAngle | 34 | true | true | 0 | 5 | 18 | 16 | 9 | 7 | null | null |
urbanslug/ghc | compiler/coreSyn/CoreSyn.hs | bsd-3-clause | -- | Returns true if 'IsOrphan' is orphan.
isOrphan :: IsOrphan -> Bool
isOrphan IsOrphan = True | 96 | isOrphan :: IsOrphan -> Bool
isOrphan IsOrphan = True | 53 | isOrphan IsOrphan = True | 24 | true | true | 0 | 7 | 16 | 25 | 11 | 14 | null | null |
noschinl/cyp | src/Test/Info2/Cyp/Term.hs | mit | isFree _ = False | 16 | isFree _ = False | 16 | isFree _ = False | 16 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
nrolland/react-flux | src/React/Flux/DOM.hs | bsd-3-clause | del_ :: Term eventHandler arg result => arg -> result; del_ = term "del" | 72 | del_ :: Term eventHandler arg result => arg -> result
del_ = term "del" | 71 | del_ = term "del" | 17 | false | true | 0 | 6 | 13 | 30 | 15 | 15 | null | null |
parsonsmatt/gol | src/Life.hs | bsd-3-clause | genericMove :: (z a -> z a) -> (z a -> z a) -> z a -> Zipper (z a)
genericMove a b z =
Zipper (tails $ iterate' a z) z (tails $ iterate' b z) | 143 | genericMove :: (z a -> z a) -> (z a -> z a) -> z a -> Zipper (z a)
genericMove a b z =
Zipper (tails $ iterate' a z) z (tails $ iterate' b z) | 143 | genericMove a b z =
Zipper (tails $ iterate' a z) z (tails $ iterate' b z) | 76 | false | true | 0 | 11 | 38 | 104 | 48 | 56 | null | null |
DavidAlphaFox/ghc | libraries/Cabal/cabal-install/Distribution/Client/Sandbox/Index.hs | bsd-3-clause | defaultIndexFileName :: FilePath
defaultIndexFileName = "00-index.tar" | 70 | defaultIndexFileName :: FilePath
defaultIndexFileName = "00-index.tar" | 70 | defaultIndexFileName = "00-index.tar" | 37 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
rahulmutt/ghcvm | compiler/Eta/Main/DriverPhases.hs | bsd-3-clause | startPhase "cmmcpp" = Cmm | 27 | startPhase "cmmcpp" = Cmm | 27 | startPhase "cmmcpp" = Cmm | 27 | false | false | 1 | 5 | 5 | 13 | 4 | 9 | null | null |
brendanhay/gogol | gogol-cloudfunctions/gen/Network/Google/Resource/CloudFunctions/Projects/Locations/Functions/List.hs | mpl-2.0 | -- | The project and location from which the function should be listed,
-- specified in the format \`projects\/*\/locations\/*\` If you want to
-- list functions in all locations, use \"-\" in place of a location. When
-- listing functions in all locations, if one or more location(s) are
-- unreachable, the response will contain functions from all reachable
-- locations along with the names of any unreachable locations.
plflParent :: Lens' ProjectsLocationsFunctionsList Text
plflParent
= lens _plflParent (\ s a -> s{_plflParent = a}) | 541 | plflParent :: Lens' ProjectsLocationsFunctionsList Text
plflParent
= lens _plflParent (\ s a -> s{_plflParent = a}) | 117 | plflParent
= lens _plflParent (\ s a -> s{_plflParent = a}) | 61 | true | true | 1 | 9 | 86 | 51 | 27 | 24 | null | null |
Forkk/ChatCore | ChatCore/Util/Parsec.hs | mit | -- | Reads characters into a Text until the given character is read.
charsUntil :: Char -> Parser T.Text
charsUntil stop = T.pack <$> charsUntilStr stop | 152 | charsUntil :: Char -> Parser T.Text
charsUntil stop = T.pack <$> charsUntilStr stop | 83 | charsUntil stop = T.pack <$> charsUntilStr stop | 47 | true | true | 0 | 7 | 25 | 33 | 16 | 17 | null | null |
cessationoftime/leksah | src/IDE/TextEditor/CodeMirror.hs | gpl-2.0 | className = js "className" | 35 | className = js "className" | 35 | className = js "className" | 35 | false | false | 0 | 5 | 12 | 9 | 4 | 5 | null | null |
CulpaBS/wbBach | src/Futhark/Analysis/AlgSimplify.hs | bsd-3-clause | linearForm :: VName -> NNumExp -> AlgSimplifyM (Maybe (NNumExp, NNumExp))
linearForm _ (NProd [] _) =
badAlgSimplifyM "linearForm: empty Prod!" | 147 | linearForm :: VName -> NNumExp -> AlgSimplifyM (Maybe (NNumExp, NNumExp))
linearForm _ (NProd [] _) =
badAlgSimplifyM "linearForm: empty Prod!" | 147 | linearForm _ (NProd [] _) =
badAlgSimplifyM "linearForm: empty Prod!" | 73 | false | true | 0 | 10 | 23 | 52 | 26 | 26 | null | null |
elliottt/din | src/Options.hs | bsd-3-clause | displayUsage :: [String] -> IO ()
displayUsage errs = do
prog <- getProgName
let banner = unlines (errs ++ ["usage: " ++ prog ++ " [OPTIONS]"])
putStrLn (usageInfo banner options) | 185 | displayUsage :: [String] -> IO ()
displayUsage errs = do
prog <- getProgName
let banner = unlines (errs ++ ["usage: " ++ prog ++ " [OPTIONS]"])
putStrLn (usageInfo banner options) | 185 | displayUsage errs = do
prog <- getProgName
let banner = unlines (errs ++ ["usage: " ++ prog ++ " [OPTIONS]"])
putStrLn (usageInfo banner options) | 151 | false | true | 0 | 16 | 35 | 81 | 38 | 43 | null | null |
nushio3/ghc | compiler/typecheck/TcType.hs | bsd-3-clause | to_tc_mapper :: TyCoMapper VarSet Identity
to_tc_mapper
= TyCoMapper { tcm_smart = False -- more efficient not to use smart ctors
, tcm_tyvar = tyvar
, tcm_covar = covar
, tcm_hole = hole
, tcm_tybinder = tybinder }
where
tyvar :: VarSet -> TyVar -> Identity Type
tyvar ftvs tv
| Just var <- lookupVarSet ftvs tv = return $ TyVarTy var
| isTcTyVar tv = TyVarTy <$> updateTyVarKindM (to_tc_type ftvs) tv
| otherwise
= do { kind' <- to_tc_type ftvs (tyVarKind tv)
; return $ TyVarTy $ mkTcTyVar (tyVarName tv) kind' vanillaSkolemTv }
covar :: VarSet -> CoVar -> Identity Coercion
covar ftvs cv
| Just var <- lookupVarSet ftvs cv = return $ CoVarCo var
| otherwise = CoVarCo <$> updateVarTypeM (to_tc_type ftvs) cv
hole :: VarSet -> CoercionHole -> Role -> Type -> Type
-> Identity Coercion
hole ftvs h r t1 t2 = mkHoleCo h r <$> to_tc_type ftvs t1
<*> to_tc_type ftvs t2
tybinder :: VarSet -> TyVar -> VisibilityFlag -> Identity (VarSet, TyVar)
tybinder ftvs tv _vis = do { kind' <- to_tc_type ftvs (tyVarKind tv)
; let tv' = mkTcTyVar (tyVarName tv) kind'
vanillaSkolemTv
; return (ftvs `extendVarSet` tv', tv') } | 1,436 | to_tc_mapper :: TyCoMapper VarSet Identity
to_tc_mapper
= TyCoMapper { tcm_smart = False -- more efficient not to use smart ctors
, tcm_tyvar = tyvar
, tcm_covar = covar
, tcm_hole = hole
, tcm_tybinder = tybinder }
where
tyvar :: VarSet -> TyVar -> Identity Type
tyvar ftvs tv
| Just var <- lookupVarSet ftvs tv = return $ TyVarTy var
| isTcTyVar tv = TyVarTy <$> updateTyVarKindM (to_tc_type ftvs) tv
| otherwise
= do { kind' <- to_tc_type ftvs (tyVarKind tv)
; return $ TyVarTy $ mkTcTyVar (tyVarName tv) kind' vanillaSkolemTv }
covar :: VarSet -> CoVar -> Identity Coercion
covar ftvs cv
| Just var <- lookupVarSet ftvs cv = return $ CoVarCo var
| otherwise = CoVarCo <$> updateVarTypeM (to_tc_type ftvs) cv
hole :: VarSet -> CoercionHole -> Role -> Type -> Type
-> Identity Coercion
hole ftvs h r t1 t2 = mkHoleCo h r <$> to_tc_type ftvs t1
<*> to_tc_type ftvs t2
tybinder :: VarSet -> TyVar -> VisibilityFlag -> Identity (VarSet, TyVar)
tybinder ftvs tv _vis = do { kind' <- to_tc_type ftvs (tyVarKind tv)
; let tv' = mkTcTyVar (tyVarName tv) kind'
vanillaSkolemTv
; return (ftvs `extendVarSet` tv', tv') } | 1,436 | to_tc_mapper
= TyCoMapper { tcm_smart = False -- more efficient not to use smart ctors
, tcm_tyvar = tyvar
, tcm_covar = covar
, tcm_hole = hole
, tcm_tybinder = tybinder }
where
tyvar :: VarSet -> TyVar -> Identity Type
tyvar ftvs tv
| Just var <- lookupVarSet ftvs tv = return $ TyVarTy var
| isTcTyVar tv = TyVarTy <$> updateTyVarKindM (to_tc_type ftvs) tv
| otherwise
= do { kind' <- to_tc_type ftvs (tyVarKind tv)
; return $ TyVarTy $ mkTcTyVar (tyVarName tv) kind' vanillaSkolemTv }
covar :: VarSet -> CoVar -> Identity Coercion
covar ftvs cv
| Just var <- lookupVarSet ftvs cv = return $ CoVarCo var
| otherwise = CoVarCo <$> updateVarTypeM (to_tc_type ftvs) cv
hole :: VarSet -> CoercionHole -> Role -> Type -> Type
-> Identity Coercion
hole ftvs h r t1 t2 = mkHoleCo h r <$> to_tc_type ftvs t1
<*> to_tc_type ftvs t2
tybinder :: VarSet -> TyVar -> VisibilityFlag -> Identity (VarSet, TyVar)
tybinder ftvs tv _vis = do { kind' <- to_tc_type ftvs (tyVarKind tv)
; let tv' = mkTcTyVar (tyVarName tv) kind'
vanillaSkolemTv
; return (ftvs `extendVarSet` tv', tv') } | 1,393 | false | true | 1 | 13 | 520 | 455 | 218 | 237 | null | null |
mortberg/AlgTop | Algebra/SNF_SparseF2.hs | bsd-3-clause | -- Transposition
transpose :: Mat -> Mat
transpose (Zero d0 d1) = Zero d1 d0 | 76 | transpose :: Mat -> Mat
transpose (Zero d0 d1) = Zero d1 d0 | 59 | transpose (Zero d0 d1) = Zero d1 d0 | 35 | true | true | 0 | 7 | 14 | 32 | 16 | 16 | null | null |
phischu/fragnix | builtins/base/GHC.IO.Encoding.UTF16.hs | bsd-3-clause | -- | @since 4.4.0.0
mkUTF16be :: CodingFailureMode -> TextEncoding
mkUTF16be cfm = TextEncoding { textEncodingName = "UTF-16BE",
mkTextDecoder = utf16be_DF cfm,
mkTextEncoder = utf16be_EF cfm } | 255 | mkUTF16be :: CodingFailureMode -> TextEncoding
mkUTF16be cfm = TextEncoding { textEncodingName = "UTF-16BE",
mkTextDecoder = utf16be_DF cfm,
mkTextEncoder = utf16be_EF cfm } | 235 | mkUTF16be cfm = TextEncoding { textEncodingName = "UTF-16BE",
mkTextDecoder = utf16be_DF cfm,
mkTextEncoder = utf16be_EF cfm } | 188 | true | true | 0 | 8 | 87 | 51 | 26 | 25 | null | null |
ekmett/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs | lgpl-2.1 | wxSTC_REBOL_IDENTIFIER :: Int
wxSTC_REBOL_IDENTIFIER = 20 | 57 | wxSTC_REBOL_IDENTIFIER :: Int
wxSTC_REBOL_IDENTIFIER = 20 | 57 | wxSTC_REBOL_IDENTIFIER = 20 | 27 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
meiersi/blaze-binary | src/Data/Blaze/Binary/StreamDecoding.hs | bsd-3-clause | benchWord8s :: S.ByteString -> [Word8]
benchWord8s bs = case runDecoder word8s bs of
Left msg -> error msg
Right x -> x | 128 | benchWord8s :: S.ByteString -> [Word8]
benchWord8s bs = case runDecoder word8s bs of
Left msg -> error msg
Right x -> x | 128 | benchWord8s bs = case runDecoder word8s bs of
Left msg -> error msg
Right x -> x | 89 | false | true | 3 | 6 | 30 | 51 | 25 | 26 | null | null |
aa755/roshask | src/Ros/Topic/Util.hs | bsd-3-clause | -- |Apply a function to each consecutive pair of elements from a 'Topic'.
finiteDifference :: (Functor m, Monad m) => (a -> a -> b) -> Topic m a -> Topic m b
finiteDifference f = fmap (uncurry f) . consecutive | 209 | finiteDifference :: (Functor m, Monad m) => (a -> a -> b) -> Topic m a -> Topic m b
finiteDifference f = fmap (uncurry f) . consecutive | 135 | finiteDifference f = fmap (uncurry f) . consecutive | 51 | true | true | 0 | 9 | 40 | 72 | 36 | 36 | null | null |
IreneKnapp/direct-http | Haskell/Network/HTTP.hs | mit | headerType HttpAllow = EntityHeader | 35 | headerType HttpAllow = EntityHeader | 35 | headerType HttpAllow = EntityHeader | 35 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
skogsbaer/HTF | Test/Framework/HUnitWrapper.hs | lgpl-2.1 | assertEqual_ :: (Eq a, Show a, AssertM m, HasCallStack)
=> String -> String -> a -> a -> m ()
assertEqual_ name s expected actual =
if expected /= actual
then do let x = equalityFailedMessage expected actual
genericAssertFailure (mkColorMsg name s $
noColor failedAt +++ x)
else return () | 376 | assertEqual_ :: (Eq a, Show a, AssertM m, HasCallStack)
=> String -> String -> a -> a -> m ()
assertEqual_ name s expected actual =
if expected /= actual
then do let x = equalityFailedMessage expected actual
genericAssertFailure (mkColorMsg name s $
noColor failedAt +++ x)
else return () | 376 | assertEqual_ name s expected actual =
if expected /= actual
then do let x = equalityFailedMessage expected actual
genericAssertFailure (mkColorMsg name s $
noColor failedAt +++ x)
else return () | 265 | false | true | 0 | 12 | 137 | 126 | 60 | 66 | null | null |
ariep/psqueues | src/Data/IntPSQ/Internal.hs | bsd-3-clause | merge :: Ord p => Mask -> IntPSQ p v -> IntPSQ p v -> IntPSQ p v
merge m l r = case l of
Nil -> r
Tip lk lp lx ->
case r of
Nil -> l
Tip rk rp rx
| (lp, lk) < (rp, rk) -> Bin lk lp lx m Nil r
| otherwise -> Bin rk rp rx m l Nil
Bin rk rp rx rm rl rr
| (lp, lk) < (rp, rk) -> Bin lk lp lx m Nil r
| otherwise -> Bin rk rp rx m l (merge rm rl rr)
Bin lk lp lx lm ll lr ->
case r of
Nil -> l
Tip rk rp rx
| (lp, lk) < (rp, rk) -> Bin lk lp lx m (merge lm ll lr) r
| otherwise -> Bin rk rp rx m l Nil
Bin rk rp rx rm rl rr
| (lp, lk) < (rp, rk) -> Bin lk lp lx m (merge lm ll lr) r
| otherwise -> Bin rk rp rx m l (merge rm rl rr)
------------------------------------------------------------------------------
-- Improved insert performance for special cases
------------------------------------------------------------------------------
-- TODO (SM): Make benchmarks run again, integrate this function with insert
-- and test how benchmarks times change.
-- | Internal function to insert a key with priority larger than the
-- maximal priority in the heap. This is always the case when using the PSQ
-- as the basis to implement a LRU cache, which associates a
-- access-tick-number with every element.
| 1,472 | merge :: Ord p => Mask -> IntPSQ p v -> IntPSQ p v -> IntPSQ p v
merge m l r = case l of
Nil -> r
Tip lk lp lx ->
case r of
Nil -> l
Tip rk rp rx
| (lp, lk) < (rp, rk) -> Bin lk lp lx m Nil r
| otherwise -> Bin rk rp rx m l Nil
Bin rk rp rx rm rl rr
| (lp, lk) < (rp, rk) -> Bin lk lp lx m Nil r
| otherwise -> Bin rk rp rx m l (merge rm rl rr)
Bin lk lp lx lm ll lr ->
case r of
Nil -> l
Tip rk rp rx
| (lp, lk) < (rp, rk) -> Bin lk lp lx m (merge lm ll lr) r
| otherwise -> Bin rk rp rx m l Nil
Bin rk rp rx rm rl rr
| (lp, lk) < (rp, rk) -> Bin lk lp lx m (merge lm ll lr) r
| otherwise -> Bin rk rp rx m l (merge rm rl rr)
------------------------------------------------------------------------------
-- Improved insert performance for special cases
------------------------------------------------------------------------------
-- TODO (SM): Make benchmarks run again, integrate this function with insert
-- and test how benchmarks times change.
-- | Internal function to insert a key with priority larger than the
-- maximal priority in the heap. This is always the case when using the PSQ
-- as the basis to implement a LRU cache, which associates a
-- access-tick-number with every element.
| 1,472 | merge m l r = case l of
Nil -> r
Tip lk lp lx ->
case r of
Nil -> l
Tip rk rp rx
| (lp, lk) < (rp, rk) -> Bin lk lp lx m Nil r
| otherwise -> Bin rk rp rx m l Nil
Bin rk rp rx rm rl rr
| (lp, lk) < (rp, rk) -> Bin lk lp lx m Nil r
| otherwise -> Bin rk rp rx m l (merge rm rl rr)
Bin lk lp lx lm ll lr ->
case r of
Nil -> l
Tip rk rp rx
| (lp, lk) < (rp, rk) -> Bin lk lp lx m (merge lm ll lr) r
| otherwise -> Bin rk rp rx m l Nil
Bin rk rp rx rm rl rr
| (lp, lk) < (rp, rk) -> Bin lk lp lx m (merge lm ll lr) r
| otherwise -> Bin rk rp rx m l (merge rm rl rr)
------------------------------------------------------------------------------
-- Improved insert performance for special cases
------------------------------------------------------------------------------
-- TODO (SM): Make benchmarks run again, integrate this function with insert
-- and test how benchmarks times change.
-- | Internal function to insert a key with priority larger than the
-- maximal priority in the heap. This is always the case when using the PSQ
-- as the basis to implement a LRU cache, which associates a
-- access-tick-number with every element.
| 1,407 | false | true | 3 | 12 | 529 | 458 | 225 | 233 | null | null |
olsner/ghc | libraries/base/Data/Data.hs | bsd-3-clause | indexConstr :: DataType -> ConIndex -> Constr
indexConstr dt idx = case datarep dt of
(AlgRep cs) -> cs !! (idx-1)
_ -> errorWithoutStackTrace $ "Data.Data.indexConstr is not supported for "
++ dataTypeName dt ++
", as it is not an algebraic data type."
-- | Gets the index of a constructor (algebraic datatypes only) | 471 | indexConstr :: DataType -> ConIndex -> Constr
indexConstr dt idx = case datarep dt of
(AlgRep cs) -> cs !! (idx-1)
_ -> errorWithoutStackTrace $ "Data.Data.indexConstr is not supported for "
++ dataTypeName dt ++
", as it is not an algebraic data type."
-- | Gets the index of a constructor (algebraic datatypes only) | 471 | indexConstr dt idx = case datarep dt of
(AlgRep cs) -> cs !! (idx-1)
_ -> errorWithoutStackTrace $ "Data.Data.indexConstr is not supported for "
++ dataTypeName dt ++
", as it is not an algebraic data type."
-- | Gets the index of a constructor (algebraic datatypes only) | 425 | false | true | 0 | 10 | 208 | 76 | 38 | 38 | null | null |
Chase-C/Flocking-Haskell | src/OctreePar.hs | gpl-2.0 | octreeMap :: (Boid -> Boid) -> Octree -> Octree
octreeMap func tree = insertList (emptyOctree (center tree) (len tree)) $ map func boids
where boids = flattenTree tree | 171 | octreeMap :: (Boid -> Boid) -> Octree -> Octree
octreeMap func tree = insertList (emptyOctree (center tree) (len tree)) $ map func boids
where boids = flattenTree tree | 171 | octreeMap func tree = insertList (emptyOctree (center tree) (len tree)) $ map func boids
where boids = flattenTree tree | 123 | false | true | 0 | 10 | 31 | 74 | 36 | 38 | null | null |
ethercrow/yi | example-configs/yi-vim-pango-dynamic/yi.hs | gpl-2.0 | main :: IO ()
main = configMain defaultConfig $ do
configurePango
myVimConfig
configureHaskellMode
configureJavaScriptMode
configureMiscModes | 186 | main :: IO ()
main = configMain defaultConfig $ do
configurePango
myVimConfig
configureHaskellMode
configureJavaScriptMode
configureMiscModes | 186 | main = configMain defaultConfig $ do
configurePango
myVimConfig
configureHaskellMode
configureJavaScriptMode
configureMiscModes | 172 | false | true | 0 | 7 | 59 | 38 | 16 | 22 | null | null |
forked-upstream-packages-for-ghcjs/ghc | compiler/typecheck/TcClassDcl.hs | bsd-3-clause | lookupHsSig :: HsSigFun -> Name -> Maybe (LHsType Name)
lookupHsSig = lookupNameEnv | 83 | lookupHsSig :: HsSigFun -> Name -> Maybe (LHsType Name)
lookupHsSig = lookupNameEnv | 83 | lookupHsSig = lookupNameEnv | 27 | false | true | 0 | 9 | 11 | 28 | 14 | 14 | null | null |
whittle/bounty | lib/Network/Memcached/Parser.hs | mit | bytes :: Parser Bytes
bytes = space >> decimal | 46 | bytes :: Parser Bytes
bytes = space >> decimal | 46 | bytes = space >> decimal | 24 | false | true | 0 | 5 | 8 | 18 | 9 | 9 | null | null |
Raveline/FQuoter | testsuite/FQuoter/Parser/ParserSpec.hs | gpl-3.0 | ttags = "((Classic, Incipit))" | 30 | ttags = "((Classic, Incipit))" | 30 | ttags = "((Classic, Incipit))" | 30 | false | false | 1 | 5 | 3 | 10 | 3 | 7 | null | null |
jacekszymanski/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs | lgpl-2.1 | wxSTC_CMD_DELLINERIGHT :: Int
wxSTC_CMD_DELLINERIGHT = 2396 | 59 | wxSTC_CMD_DELLINERIGHT :: Int
wxSTC_CMD_DELLINERIGHT = 2396 | 59 | wxSTC_CMD_DELLINERIGHT = 2396 | 29 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
MagneticDuck/simpleirc | Network/SimpleIRC/Messages.hs | bsd-3-clause | dropColon :: B.ByteString -> B.ByteString
dropColon xs =
if B.take 1 xs == B.pack ":"
then B.drop 1 xs
else xs | 120 | dropColon :: B.ByteString -> B.ByteString
dropColon xs =
if B.take 1 xs == B.pack ":"
then B.drop 1 xs
else xs | 120 | dropColon xs =
if B.take 1 xs == B.pack ":"
then B.drop 1 xs
else xs | 78 | false | true | 0 | 8 | 30 | 59 | 27 | 32 | null | null |
rahulmutt/codec-jvm | src/Codec/JVM/Types.hs | apache-2.0 | accessFlagValue :: AccessFlag -> Word16
accessFlagValue Public = 0x0001 | 78 | accessFlagValue :: AccessFlag -> Word16
accessFlagValue Public = 0x0001 | 78 | accessFlagValue Public = 0x0001 | 38 | false | true | 0 | 7 | 15 | 24 | 10 | 14 | null | null |
music-suite/music-preludes | src/Music/Prelude/CmdLine.hs | bsd-3-clause | -- |
-- Generates a basic converter program that invokes @lilypond@ to generate
-- music notation. Used for @music2pdf@ etc.
--
lilypondConverterMain
:: String -- ^ A file extension (supported by Lilypond).
-> IO ()
lilypondConverterMain ext = do
pgmName <- getProgName
options <- execParser (opts pgmName)
runLilypondConverter ext options
where
opts pgmName = info
(helper <*> lilypondConverterOptions)
(fullDesc <> header (pgmName ++ "-" ++ versionString))
runLilypondConverter ext (LilypondConverterOptions prelude inFile)
= translateFileAndRunLilypond ext prelude (Just inFile)
-- |
-- Translate an input file and invoke Lilypond on the resulting output file.
-- | 712 | lilypondConverterMain
:: String -- ^ A file extension (supported by Lilypond).
-> IO ()
lilypondConverterMain ext = do
pgmName <- getProgName
options <- execParser (opts pgmName)
runLilypondConverter ext options
where
opts pgmName = info
(helper <*> lilypondConverterOptions)
(fullDesc <> header (pgmName ++ "-" ++ versionString))
runLilypondConverter ext (LilypondConverterOptions prelude inFile)
= translateFileAndRunLilypond ext prelude (Just inFile)
-- |
-- Translate an input file and invoke Lilypond on the resulting output file.
-- | 583 | lilypondConverterMain ext = do
pgmName <- getProgName
options <- execParser (opts pgmName)
runLilypondConverter ext options
where
opts pgmName = info
(helper <*> lilypondConverterOptions)
(fullDesc <> header (pgmName ++ "-" ++ versionString))
runLilypondConverter ext (LilypondConverterOptions prelude inFile)
= translateFileAndRunLilypond ext prelude (Just inFile)
-- |
-- Translate an input file and invoke Lilypond on the resulting output file.
-- | 491 | true | true | 1 | 10 | 138 | 145 | 70 | 75 | null | null |
jaalonso/I1M-Cod-Temas | src/Tema_22/GrafoConVectorDeAdyacencia.hs | gpl-2.0 | -- (aristaEn g a) se verifica si a es una arista del grafo g. Por
-- ejemplo,
-- aristaEn ejGrafoND (5,1) == True
-- aristaEn ejGrafoND (4,1) == False
-- aristaEn ejGrafoD (5,1) == False
-- aristaEn ejGrafoD (1,5) == True
aristaEn :: (Ix v,Num p) => Grafo v p -> (v,v) -> Bool
aristaEn g (x,y) = y `elem` adyacentes g x | 341 | aristaEn :: (Ix v,Num p) => Grafo v p -> (v,v) -> Bool
aristaEn g (x,y) = y `elem` adyacentes g x | 97 | aristaEn g (x,y) = y `elem` adyacentes g x | 42 | true | true | 0 | 8 | 84 | 73 | 42 | 31 | null | null |
hvr/lens | src/Control/Lens/Fold.hs | bsd-3-clause | -- | Right-associative fold of parts of a structure that are viewed through an 'IndexedFold' or 'IndexedTraversal' with
-- access to the @i@.
--
-- When you don't need access to the index then 'foldrOf' is more flexible in what it accepts.
--
-- @
-- 'foldrOf' l ≡ 'ifoldrOf' l '.' 'const'
-- @
--
-- @
-- 'ifoldrOf' :: 'IndexedGetter' i s a -> (i -> a -> r -> r) -> r -> s -> r
-- 'ifoldrOf' :: 'IndexedFold' i s a -> (i -> a -> r -> r) -> r -> s -> r
-- 'ifoldrOf' :: 'IndexedLens'' i s a -> (i -> a -> r -> r) -> r -> s -> r
-- 'ifoldrOf' :: 'IndexedTraversal'' i s a -> (i -> a -> r -> r) -> r -> s -> r
-- @
ifoldrOf :: IndexedGetting i (Endo r) s a -> (i -> a -> r -> r) -> r -> s -> r
ifoldrOf l = foldrOf l .# Indexed | 740 | ifoldrOf :: IndexedGetting i (Endo r) s a -> (i -> a -> r -> r) -> r -> s -> r
ifoldrOf l = foldrOf l .# Indexed | 112 | ifoldrOf l = foldrOf l .# Indexed | 33 | true | true | 0 | 10 | 187 | 82 | 48 | 34 | null | null |
TGOlson/blockchain | lib/Data/Blockchain/Types/Blockchain.hs | bsd-3-clause | unspentTransactionOutputs :: Blockchain Validated -> H.HashMap Crypto.PublicKey [(TransactionOutRef, TransactionOut)]
unspentTransactionOutputs blockchain = H.fromListWith (<>) (toPair <$> unspentTxOuts)
where
toPair (txRef, txOut) = (signaturePubKey txOut, pure (txRef, txOut))
unspentTxOuts = H.toList $ unspentTransactionOutputsInternal (NonEmpty.toList $ longestChain blockchain) | 393 | unspentTransactionOutputs :: Blockchain Validated -> H.HashMap Crypto.PublicKey [(TransactionOutRef, TransactionOut)]
unspentTransactionOutputs blockchain = H.fromListWith (<>) (toPair <$> unspentTxOuts)
where
toPair (txRef, txOut) = (signaturePubKey txOut, pure (txRef, txOut))
unspentTxOuts = H.toList $ unspentTransactionOutputsInternal (NonEmpty.toList $ longestChain blockchain) | 393 | unspentTransactionOutputs blockchain = H.fromListWith (<>) (toPair <$> unspentTxOuts)
where
toPair (txRef, txOut) = (signaturePubKey txOut, pure (txRef, txOut))
unspentTxOuts = H.toList $ unspentTransactionOutputsInternal (NonEmpty.toList $ longestChain blockchain) | 275 | false | true | 0 | 9 | 45 | 116 | 61 | 55 | null | null |
YPBlib/NaiveFunGame_hs | cw/esolang.hs | gpl-3.0 | mainf (xs,[x],y:ys) '0' = (xs ++ [x],[y],ys) | 45 | mainf (xs,[x],y:ys) '0' = (xs ++ [x],[y],ys) | 45 | mainf (xs,[x],y:ys) '0' = (xs ++ [x],[y],ys) | 45 | false | false | 1 | 8 | 7 | 51 | 27 | 24 | null | null |
brendanhay/gogol | gogol-containeranalysis/gen/Network/Google/Resource/ContainerAnalysis/Projects/Notes/SetIAMPolicy.hs | mpl-2.0 | -- | Upload protocol for media (e.g. \"raw\", \"multipart\").
pnsipUploadProtocol :: Lens' ProjectsNotesSetIAMPolicy (Maybe Text)
pnsipUploadProtocol
= lens _pnsipUploadProtocol
(\ s a -> s{_pnsipUploadProtocol = a}) | 224 | pnsipUploadProtocol :: Lens' ProjectsNotesSetIAMPolicy (Maybe Text)
pnsipUploadProtocol
= lens _pnsipUploadProtocol
(\ s a -> s{_pnsipUploadProtocol = a}) | 162 | pnsipUploadProtocol
= lens _pnsipUploadProtocol
(\ s a -> s{_pnsipUploadProtocol = a}) | 94 | true | true | 0 | 9 | 33 | 48 | 25 | 23 | null | null |
flofehrenbacher/music-project | EasyNotes/MouseEvents.hs | gpl-3.0 | isYPositionBlackKey :: GLint -> GLint -> Bool
isYPositionBlackKey y ySize = fromEnum y > (yStartBlackKey + (fromEnum ((ySize - initHeight) `div` 2))) && fromEnum y < (yEndBlackKey + (fromEnum ((ySize - initHeight) `div` 2))) | 234 | isYPositionBlackKey :: GLint -> GLint -> Bool
isYPositionBlackKey y ySize = fromEnum y > (yStartBlackKey + (fromEnum ((ySize - initHeight) `div` 2))) && fromEnum y < (yEndBlackKey + (fromEnum ((ySize - initHeight) `div` 2))) | 234 | isYPositionBlackKey y ySize = fromEnum y > (yStartBlackKey + (fromEnum ((ySize - initHeight) `div` 2))) && fromEnum y < (yEndBlackKey + (fromEnum ((ySize - initHeight) `div` 2))) | 188 | false | true | 0 | 15 | 43 | 100 | 54 | 46 | null | null |
m4dc4p/haskelldb | test/TestCases.hs | bsd-3-clause | testCorrectGroupBy = noDBTest "Testing that groupby is correct with projections" $ do
let qryTxt = showSql $ do
p <- table int_tbl
r <- project (TInt.f01 << (p ! TInt.f01))
unique
return r
groupByTxt = mkRegex "GROUP BY.*f01.*"
hasMatch = maybe (False) (const True) (matchRegex groupByTxt qryTxt)
assertBool ("GROUP BY does not have correct columns: " ++ qryTxt) hasMatch | 419 | testCorrectGroupBy = noDBTest "Testing that groupby is correct with projections" $ do
let qryTxt = showSql $ do
p <- table int_tbl
r <- project (TInt.f01 << (p ! TInt.f01))
unique
return r
groupByTxt = mkRegex "GROUP BY.*f01.*"
hasMatch = maybe (False) (const True) (matchRegex groupByTxt qryTxt)
assertBool ("GROUP BY does not have correct columns: " ++ qryTxt) hasMatch | 419 | testCorrectGroupBy = noDBTest "Testing that groupby is correct with projections" $ do
let qryTxt = showSql $ do
p <- table int_tbl
r <- project (TInt.f01 << (p ! TInt.f01))
unique
return r
groupByTxt = mkRegex "GROUP BY.*f01.*"
hasMatch = maybe (False) (const True) (matchRegex groupByTxt qryTxt)
assertBool ("GROUP BY does not have correct columns: " ++ qryTxt) hasMatch | 419 | false | false | 0 | 20 | 106 | 125 | 59 | 66 | null | null |
mpickering/slack-api | src/Web/Slack/Types/IM.hs | mit | channelToIM :: ChannelId -> IMId
channelToIM = coerce | 53 | channelToIM :: ChannelId -> IMId
channelToIM = coerce | 53 | channelToIM = coerce | 20 | false | true | 0 | 5 | 7 | 15 | 8 | 7 | null | null |
dhruvrajan/haskell-parser | src/Anatomy/Evaluator.hs | bsd-3-clause | evaluateExpr _ (Number num) = num | 33 | evaluateExpr _ (Number num) = num | 33 | evaluateExpr _ (Number num) = num | 33 | false | false | 0 | 7 | 5 | 17 | 8 | 9 | null | null |
kawu/partage | src/NLP/Partage/AStar/Chart.hs | bsd-2-clause | rootSpan
:: (Ord n, MS.MonadState s m)
=> (s -> Chart n t)
-> n -> (Pos, Pos)
-> P.ListT m (Passive n t, DuoWeight)
rootSpan getChart x (i, j) = do
Chart{..} <- getChart <$> lift MS.get
P.Select $ do
P.each $ case M.lookup i donePassiveIni >>= M.lookup x >>= M.lookup j of
Nothing -> []
Just m -> map (Arr.second duoWeight) (M.toList m)
-- ((M.elems >=> M.toList) m)
P.each $ case M.lookup i donePassiveAuxNoTop >>= M.lookup x >>= M.lookup j of
Nothing -> []
Just m -> map (Arr.second duoWeight) (M.toList m)
-- | Return all active processed items which:
-- * has the given LHS non-terminal,
-- * end on the given position. | 694 | rootSpan
:: (Ord n, MS.MonadState s m)
=> (s -> Chart n t)
-> n -> (Pos, Pos)
-> P.ListT m (Passive n t, DuoWeight)
rootSpan getChart x (i, j) = do
Chart{..} <- getChart <$> lift MS.get
P.Select $ do
P.each $ case M.lookup i donePassiveIni >>= M.lookup x >>= M.lookup j of
Nothing -> []
Just m -> map (Arr.second duoWeight) (M.toList m)
-- ((M.elems >=> M.toList) m)
P.each $ case M.lookup i donePassiveAuxNoTop >>= M.lookup x >>= M.lookup j of
Nothing -> []
Just m -> map (Arr.second duoWeight) (M.toList m)
-- | Return all active processed items which:
-- * has the given LHS non-terminal,
-- * end on the given position. | 694 | rootSpan getChart x (i, j) = do
Chart{..} <- getChart <$> lift MS.get
P.Select $ do
P.each $ case M.lookup i donePassiveIni >>= M.lookup x >>= M.lookup j of
Nothing -> []
Just m -> map (Arr.second duoWeight) (M.toList m)
-- ((M.elems >=> M.toList) m)
P.each $ case M.lookup i donePassiveAuxNoTop >>= M.lookup x >>= M.lookup j of
Nothing -> []
Just m -> map (Arr.second duoWeight) (M.toList m)
-- | Return all active processed items which:
-- * has the given LHS non-terminal,
-- * end on the given position. | 562 | false | true | 0 | 17 | 186 | 278 | 136 | 142 | null | null |
leonschoorl/sprockell | src/Sprockell/BasicFunctions.hs | mit | -- usage of registers A-F to be chosen by the user
regB = 3 :: Int | 78 | regB = 3 :: Int | 27 | regB = 3 :: Int | 27 | true | false | 0 | 4 | 27 | 10 | 6 | 4 | null | null |
lpeterse/binary-generic | src/Data/Binary/Generic/Extensions.hs | bsd-3-clause | roll :: [Word8] -> Integer
roll = foldr unstep 0
where
unstep b a = a `shiftL` 8 .|. fromIntegral b | 107 | roll :: [Word8] -> Integer
roll = foldr unstep 0
where
unstep b a = a `shiftL` 8 .|. fromIntegral b | 107 | roll = foldr unstep 0
where
unstep b a = a `shiftL` 8 .|. fromIntegral b | 80 | false | true | 0 | 7 | 28 | 56 | 26 | 30 | null | null |
markus1189/xmonad-710 | XMonad/Config.hs | bsd-3-clause | -- | Perform an arbitrary action at xmonad startup.
startupHook :: X ()
startupHook = return () | 95 | startupHook :: X ()
startupHook = return () | 43 | startupHook = return () | 23 | true | true | 0 | 6 | 16 | 22 | 11 | 11 | null | null |
karshan/language-java | Language/Java/Parser.hs | bsd-3-clause | instanceCreation :: P Exp
instanceCreation = try instanceCreationNPS <|> do
p <- primaryNPS
ss <- list primarySuffix
let icp = foldl (\a s -> s a) p ss
case icp of
QualInstanceCreation {} -> return icp
_ -> fail ""
{-
instanceCreation =
(do tok KW_New
tas <- lopt typeArgs
ct <- classType
as <- args
mcb <- opt classBody
return $ InstanceCreation tas ct as mcb) <|>
(do p <- primary
period >> tok KW_New
tas <- lopt typeArgs
i <- ident
as <- args
mcb <- opt classBody
return $ QualInstanceCreation p tas i as mcb)
-} | 646 | instanceCreation :: P Exp
instanceCreation = try instanceCreationNPS <|> do
p <- primaryNPS
ss <- list primarySuffix
let icp = foldl (\a s -> s a) p ss
case icp of
QualInstanceCreation {} -> return icp
_ -> fail ""
{-
instanceCreation =
(do tok KW_New
tas <- lopt typeArgs
ct <- classType
as <- args
mcb <- opt classBody
return $ InstanceCreation tas ct as mcb) <|>
(do p <- primary
period >> tok KW_New
tas <- lopt typeArgs
i <- ident
as <- args
mcb <- opt classBody
return $ QualInstanceCreation p tas i as mcb)
-} | 646 | instanceCreation = try instanceCreationNPS <|> do
p <- primaryNPS
ss <- list primarySuffix
let icp = foldl (\a s -> s a) p ss
case icp of
QualInstanceCreation {} -> return icp
_ -> fail ""
{-
instanceCreation =
(do tok KW_New
tas <- lopt typeArgs
ct <- classType
as <- args
mcb <- opt classBody
return $ InstanceCreation tas ct as mcb) <|>
(do p <- primary
period >> tok KW_New
tas <- lopt typeArgs
i <- ident
as <- args
mcb <- opt classBody
return $ QualInstanceCreation p tas i as mcb)
-} | 620 | false | true | 1 | 15 | 228 | 97 | 45 | 52 | null | null |
ogma-project/ogma | test/GraphSpec.hs | mit | spec :: Spec
spec = do
checkSelectableLaws @(Edges (Character :- Relation :-> Character)) "Simple Edge"
checkSelectableLaws @(Edges TGraph) "Composed Edges"
checkRelation "Eq for Simple Edge" (\(x :: Edges (Character :- Relation :-> Character)) y -> x == y)
checkRelation "Eq for Composed Edges" (\(x :: Edges TGraph) y -> x == y)
describe "Aeson instances (Simple Edge)" $
it "should be inverse functions of each other" $ property $
\x -> (fromJSON . toJSON) x == Success (x ::Edges (Character :- Relation :-> Character))
describe "Aeson instances (Composed Edges)" $
it "should be inverse functions of each other" $ property $
\x -> (fromJSON . toJSON) x == Success (x ::Edges TGraph)
describe "selectEdges" $ do
it "should select everything" $
selectEdges everything `shouldBe`
Identity allRes
it "should select only Relation" $
selectEdges (EProd everything nothing) `shouldBe`
Identity onlyRelation
it "should select only FriendsWith" $
selectEdges selectFriends `shouldBe`
Identity onlyFriends | 1,093 | spec :: Spec
spec = do
checkSelectableLaws @(Edges (Character :- Relation :-> Character)) "Simple Edge"
checkSelectableLaws @(Edges TGraph) "Composed Edges"
checkRelation "Eq for Simple Edge" (\(x :: Edges (Character :- Relation :-> Character)) y -> x == y)
checkRelation "Eq for Composed Edges" (\(x :: Edges TGraph) y -> x == y)
describe "Aeson instances (Simple Edge)" $
it "should be inverse functions of each other" $ property $
\x -> (fromJSON . toJSON) x == Success (x ::Edges (Character :- Relation :-> Character))
describe "Aeson instances (Composed Edges)" $
it "should be inverse functions of each other" $ property $
\x -> (fromJSON . toJSON) x == Success (x ::Edges TGraph)
describe "selectEdges" $ do
it "should select everything" $
selectEdges everything `shouldBe`
Identity allRes
it "should select only Relation" $
selectEdges (EProd everything nothing) `shouldBe`
Identity onlyRelation
it "should select only FriendsWith" $
selectEdges selectFriends `shouldBe`
Identity onlyFriends | 1,093 | spec = do
checkSelectableLaws @(Edges (Character :- Relation :-> Character)) "Simple Edge"
checkSelectableLaws @(Edges TGraph) "Composed Edges"
checkRelation "Eq for Simple Edge" (\(x :: Edges (Character :- Relation :-> Character)) y -> x == y)
checkRelation "Eq for Composed Edges" (\(x :: Edges TGraph) y -> x == y)
describe "Aeson instances (Simple Edge)" $
it "should be inverse functions of each other" $ property $
\x -> (fromJSON . toJSON) x == Success (x ::Edges (Character :- Relation :-> Character))
describe "Aeson instances (Composed Edges)" $
it "should be inverse functions of each other" $ property $
\x -> (fromJSON . toJSON) x == Success (x ::Edges TGraph)
describe "selectEdges" $ do
it "should select everything" $
selectEdges everything `shouldBe`
Identity allRes
it "should select only Relation" $
selectEdges (EProd everything nothing) `shouldBe`
Identity onlyRelation
it "should select only FriendsWith" $
selectEdges selectFriends `shouldBe`
Identity onlyFriends | 1,080 | false | true | 0 | 15 | 243 | 328 | 158 | 170 | null | null |
Coggroach/Gluon | src/SecurityServer.hs | bsd-3-clause | contains :: String -> ApiHandler CommonServer.Response
contains c = liftIO $ do
logConnection "" "securityServer" "GET contains"
client <- findClient c
logTrailing
case length client of
0 -> return (CommonServer.Response CommonServer.SecurityClientNotRegistered securityServerIdentity "")
_ -> return (CommonServer.Response CommonServer.SecurityClientRegistered securityServerIdentity "") | 421 | contains :: String -> ApiHandler CommonServer.Response
contains c = liftIO $ do
logConnection "" "securityServer" "GET contains"
client <- findClient c
logTrailing
case length client of
0 -> return (CommonServer.Response CommonServer.SecurityClientNotRegistered securityServerIdentity "")
_ -> return (CommonServer.Response CommonServer.SecurityClientRegistered securityServerIdentity "") | 421 | contains c = liftIO $ do
logConnection "" "securityServer" "GET contains"
client <- findClient c
logTrailing
case length client of
0 -> return (CommonServer.Response CommonServer.SecurityClientNotRegistered securityServerIdentity "")
_ -> return (CommonServer.Response CommonServer.SecurityClientRegistered securityServerIdentity "") | 366 | false | true | 0 | 14 | 72 | 106 | 48 | 58 | null | null |
rodrigogribeiro/mptc | src/Language/Haskell/Exts/Parser.hs | bsd-3-clause | -- | Parse of a string containing a Haskell type.
parseStmt :: String -> ParseResult S.Stmt
parseStmt = fmap sStmt . P.parseStmt | 128 | parseStmt :: String -> ParseResult S.Stmt
parseStmt = fmap sStmt . P.parseStmt | 78 | parseStmt = fmap sStmt . P.parseStmt | 36 | true | true | 0 | 7 | 21 | 30 | 15 | 15 | null | null |
kawu/tagger | src/LogMath.hs | bsd-3-clause | logAdd :: Double -> Double -> Double
logAdd x y
| logIsZero x = y
| x > y = x + log1p(exp(y - x))
| otherwise = y + log1p(exp(x - y)) | 159 | logAdd :: Double -> Double -> Double
logAdd x y
| logIsZero x = y
| x > y = x + log1p(exp(y - x))
| otherwise = y + log1p(exp(x - y)) | 159 | logAdd x y
| logIsZero x = y
| x > y = x + log1p(exp(y - x))
| otherwise = y + log1p(exp(x - y)) | 122 | false | true | 2 | 10 | 58 | 93 | 45 | 48 | null | null |
phaazon/OpenGLRaw | src/Graphics/Rendering/OpenGL/Raw/Tokens.hs | bsd-3-clause | gl_SLUMINANCE8_NV :: GLenum
gl_SLUMINANCE8_NV = 0x8C47 | 54 | gl_SLUMINANCE8_NV :: GLenum
gl_SLUMINANCE8_NV = 0x8C47 | 54 | gl_SLUMINANCE8_NV = 0x8C47 | 26 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
amccausl/RDF4H | src/Data/RDF/Namespace.hs | bsd-3-clause | -- |The SKOS namespace.
skos :: Namespace
skos = mkPrefixedNS' "skos" "http://www.w3.org/2004/02/skos/core#" | 113 | skos :: Namespace
skos = mkPrefixedNS' "skos" "http://www.w3.org/2004/02/skos/core#" | 89 | skos = mkPrefixedNS' "skos" "http://www.w3.org/2004/02/skos/core#" | 71 | true | true | 0 | 5 | 16 | 17 | 9 | 8 | null | null |
sherwoodwang/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs | lgpl-2.1 | wxCBAR_DOCKED_HORIZONTALLY :: Int
wxCBAR_DOCKED_HORIZONTALLY = 0 | 64 | wxCBAR_DOCKED_HORIZONTALLY :: Int
wxCBAR_DOCKED_HORIZONTALLY = 0 | 64 | wxCBAR_DOCKED_HORIZONTALLY = 0 | 30 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
ijks/hexagons | src/Grid.hs | mit | (!?) :: Grid a -> Hex Int -> Maybe a
(!?) = flip elemAt | 55 | (!?) :: Grid a -> Hex Int -> Maybe a
(!?) = flip elemAt | 55 | (!?) = flip elemAt | 18 | false | true | 0 | 7 | 13 | 35 | 18 | 17 | null | null |
hausdorff/pyle | src/Regex.hs | mit | union RegexEps y | isNullable y = y | 35 | union RegexEps y | isNullable y = y | 35 | union RegexEps y | isNullable y = y | 35 | false | false | 1 | 5 | 7 | 21 | 8 | 13 | null | null |
cgroza/HsRegex | HsRegex.hs | gpl-3.0 | -- return all matches of (combine rs)
matchRegex :: [Regex Bool] -> T.Text -> [(Int, Int)]
matchRegex rs ss = S.join $ map (snd . runWriter . subMatch ss (combine rs))
[0 .. T.length ss]
where subMatch :: T.Text -> Regex Bool -> Int -> Writer [(Int, Int)] ()
subMatch str re i =
let st = execState re (RegexS False [] str [[i]])
pos = position st in
when (pos <= T.length (text st) && not (failed st)) $ tell [(i, pos)]
-- -- apply the regex on tails str and return bigest match | 545 | matchRegex :: [Regex Bool] -> T.Text -> [(Int, Int)]
matchRegex rs ss = S.join $ map (snd . runWriter . subMatch ss (combine rs))
[0 .. T.length ss]
where subMatch :: T.Text -> Regex Bool -> Int -> Writer [(Int, Int)] ()
subMatch str re i =
let st = execState re (RegexS False [] str [[i]])
pos = position st in
when (pos <= T.length (text st) && not (failed st)) $ tell [(i, pos)]
-- -- apply the regex on tails str and return bigest match | 506 | matchRegex rs ss = S.join $ map (snd . runWriter . subMatch ss (combine rs))
[0 .. T.length ss]
where subMatch :: T.Text -> Regex Bool -> Int -> Writer [(Int, Int)] ()
subMatch str re i =
let st = execState re (RegexS False [] str [[i]])
pos = position st in
when (pos <= T.length (text st) && not (failed st)) $ tell [(i, pos)]
-- -- apply the regex on tails str and return bigest match | 452 | true | true | 2 | 13 | 161 | 245 | 122 | 123 | null | null |
SeanTater/hypergraph-disambiguate | src/Main.hs | apache-2.0 | -- | Count the words prior to making contexts (to save much memory)
bloomChunk :: Text.Text -> P.Popularity
bloomChunk = P.countChunk . U.conservativeTokenize | 158 | bloomChunk :: Text.Text -> P.Popularity
bloomChunk = P.countChunk . U.conservativeTokenize | 90 | bloomChunk = P.countChunk . U.conservativeTokenize | 50 | true | true | 0 | 8 | 22 | 35 | 16 | 19 | null | null |
oshyshko/adventofcode | src.exe/SysInfo.hs | bsd-3-clause | execM :: FilePath -> IO (Maybe String)
execM cmd = tryOrNothing $
(\(_, out, _) -> out)
<$> readProcessWithExitCode c args ""
where c:args = words cmd
-- readFileM :: FilePath -> IO (Maybe String)
-- readFileM path = tryOrNothing $ readFile path | 270 | execM :: FilePath -> IO (Maybe String)
execM cmd = tryOrNothing $
(\(_, out, _) -> out)
<$> readProcessWithExitCode c args ""
where c:args = words cmd
-- readFileM :: FilePath -> IO (Maybe String)
-- readFileM path = tryOrNothing $ readFile path | 270 | execM cmd = tryOrNothing $
(\(_, out, _) -> out)
<$> readProcessWithExitCode c args ""
where c:args = words cmd
-- readFileM :: FilePath -> IO (Maybe String)
-- readFileM path = tryOrNothing $ readFile path | 231 | false | true | 1 | 9 | 67 | 81 | 41 | 40 | null | null |
spechub/Hets | Omega/ToLisp.hs | gpl-2.0 | -- | Outputs a library to omega's lisp format.
printLibrary :: Library -> String
printLibrary = toSExpr emptyEnv | 112 | printLibrary :: Library -> String
printLibrary = toSExpr emptyEnv | 65 | printLibrary = toSExpr emptyEnv | 31 | true | true | 0 | 5 | 17 | 19 | 10 | 9 | null | null |
mbg/monadic-state-hierarchies | Language/MSH/CodeGen/Decls.hs | mit | -- { _fieldToDef = lensLookup }
-- | Generates top-level declarations for a state declaration
genStateDecl :: StateEnv -> StateDecl -> Q [Dec]
genStateDecl env s@(StateDecl { stateParams = vars, stateBody = decls }) = do
let
tyvars = map (PlainTV . mkName) vars
d <- genStateData tyvars s
ls <- makeFieldOpticsForDec stateLensRules d
t <- genStateType tyvars s
o <- genStateObject tyvars s
c <- genStateClass env tyvars decls s
is <- genStateInstances env c decls s
cs <- genConstructors env s
misc <- genMiscInstances s o cs
ms <- genMethods env s (stateName s) vars decls
return $ [d,t,o,c] ++ is ++ ls ++ [sctrDec cs] ++ ms ++ misc | 694 | genStateDecl :: StateEnv -> StateDecl -> Q [Dec]
genStateDecl env s@(StateDecl { stateParams = vars, stateBody = decls }) = do
let
tyvars = map (PlainTV . mkName) vars
d <- genStateData tyvars s
ls <- makeFieldOpticsForDec stateLensRules d
t <- genStateType tyvars s
o <- genStateObject tyvars s
c <- genStateClass env tyvars decls s
is <- genStateInstances env c decls s
cs <- genConstructors env s
misc <- genMiscInstances s o cs
ms <- genMethods env s (stateName s) vars decls
return $ [d,t,o,c] ++ is ++ ls ++ [sctrDec cs] ++ ms ++ misc | 599 | genStateDecl env s@(StateDecl { stateParams = vars, stateBody = decls }) = do
let
tyvars = map (PlainTV . mkName) vars
d <- genStateData tyvars s
ls <- makeFieldOpticsForDec stateLensRules d
t <- genStateType tyvars s
o <- genStateObject tyvars s
c <- genStateClass env tyvars decls s
is <- genStateInstances env c decls s
cs <- genConstructors env s
misc <- genMiscInstances s o cs
ms <- genMethods env s (stateName s) vars decls
return $ [d,t,o,c] ++ is ++ ls ++ [sctrDec cs] ++ ms ++ misc | 550 | true | true | 0 | 13 | 171 | 249 | 120 | 129 | null | null |
emmanueltouzery/cigale-timesheet | src/WebServer/FilePickerServer.hs | mit | browseFolder :: Snap ()
browseFolder = do
homeDir <- liftIO $ TE.encodeUtf8 . T.pack <$> getHomeDirectory
modifyResponse $ setContentType "application/json"
curFolder <- T.unpack . TE.decodeUtf8 . fromMaybe homeDir <$> getParam "path"
files <- liftIO $ getDirectoryContents curFolder
fileInfos <- liftIO $ mapM (fileInfo curFolder) files
let response = BrowseResponse curFolder fileInfos
writeLBS $ encode response | 442 | browseFolder :: Snap ()
browseFolder = do
homeDir <- liftIO $ TE.encodeUtf8 . T.pack <$> getHomeDirectory
modifyResponse $ setContentType "application/json"
curFolder <- T.unpack . TE.decodeUtf8 . fromMaybe homeDir <$> getParam "path"
files <- liftIO $ getDirectoryContents curFolder
fileInfos <- liftIO $ mapM (fileInfo curFolder) files
let response = BrowseResponse curFolder fileInfos
writeLBS $ encode response | 442 | browseFolder = do
homeDir <- liftIO $ TE.encodeUtf8 . T.pack <$> getHomeDirectory
modifyResponse $ setContentType "application/json"
curFolder <- T.unpack . TE.decodeUtf8 . fromMaybe homeDir <$> getParam "path"
files <- liftIO $ getDirectoryContents curFolder
fileInfos <- liftIO $ mapM (fileInfo curFolder) files
let response = BrowseResponse curFolder fileInfos
writeLBS $ encode response | 418 | false | true | 0 | 11 | 82 | 138 | 62 | 76 | null | null |
cirquit/Personal-Repository | Haskell/RWH/FileSystem/BetterPredicate.hs | mit | -- path -> permissions -> filesize in (B) -> last modified
-- how to get the infix of operators -> :info ==
pathP :: InfoP FilePath
pathP path _ _ _ = path | 165 | pathP :: InfoP FilePath
pathP path _ _ _ = path | 47 | pathP path _ _ _ = path | 23 | true | true | 0 | 5 | 42 | 25 | 13 | 12 | null | null |
FranklinChen/Idris-dev | src/IRTS/CodegenJavaScript.hs | bsd-3-clause | jsTOP n = JSIndex jsSTACK (JSBinOp "+" jsSTACKTOP (JSNum (JSInt n))) | 68 | jsTOP n = JSIndex jsSTACK (JSBinOp "+" jsSTACKTOP (JSNum (JSInt n))) | 68 | jsTOP n = JSIndex jsSTACK (JSBinOp "+" jsSTACKTOP (JSNum (JSInt n))) | 68 | false | false | 1 | 11 | 10 | 40 | 17 | 23 | null | null |
lcycon/QuickScala | Language/Scala/Parse.hs | gpl-3.0 | parens = P.parens scalaLexer | 28 | parens = P.parens scalaLexer | 28 | parens = P.parens scalaLexer | 28 | false | false | 0 | 6 | 3 | 11 | 5 | 6 | null | null |
yliu120/K3 | src/Language/K3/Analysis/Provenance/Inference.hs | apache-2.0 | pifreshbp :: PIEnv -> Identifier -> UID -> K3 Provenance -> (K3 Provenance, PIEnv)
pifreshbp pienv i u p =
let j = pcnt pienv
p' = pbvar $ PMatVar i u j
in (p', piextp (pienv {pcnt=j+1}) j p) | 202 | pifreshbp :: PIEnv -> Identifier -> UID -> K3 Provenance -> (K3 Provenance, PIEnv)
pifreshbp pienv i u p =
let j = pcnt pienv
p' = pbvar $ PMatVar i u j
in (p', piextp (pienv {pcnt=j+1}) j p) | 202 | pifreshbp pienv i u p =
let j = pcnt pienv
p' = pbvar $ PMatVar i u j
in (p', piextp (pienv {pcnt=j+1}) j p) | 119 | false | true | 0 | 13 | 50 | 112 | 55 | 57 | null | null |
d-day/relation | src/Data/Relation.hs | bsd-3-clause | delete :: (Ord a, Ord b)
=> a -> b -> Relation a b -> Relation a b
delete x y r = r { domain = domain', range = range' }
where
domain' = M.update (erase y) x (domain r)
range' = M.update (erase x) y (range r)
erase e s = if S.singleton e == s
then Nothing
else Just $ S.delete e s
-- | The Set of values associated with a value in the domain. | 451 | delete :: (Ord a, Ord b)
=> a -> b -> Relation a b -> Relation a b
delete x y r = r { domain = domain', range = range' }
where
domain' = M.update (erase y) x (domain r)
range' = M.update (erase x) y (range r)
erase e s = if S.singleton e == s
then Nothing
else Just $ S.delete e s
-- | The Set of values associated with a value in the domain. | 448 | delete x y r = r { domain = domain', range = range' }
where
domain' = M.update (erase y) x (domain r)
range' = M.update (erase x) y (range r)
erase e s = if S.singleton e == s
then Nothing
else Just $ S.delete e s
-- | The Set of values associated with a value in the domain. | 358 | false | true | 0 | 9 | 187 | 163 | 83 | 80 | null | null |
abakst/liquidhaskell | benchmarks/nofib/imaginary/exp3_8/Main.hs | bsd-3-clause | int :: NatT -> Int
int Z = 0 | 33 | int :: NatT -> Int
int Z = 0 | 32 | int Z = 0 | 13 | false | true | 0 | 5 | 13 | 22 | 10 | 12 | null | null |
trenta3/zeno-0.2.0.1 | Example.hs | mit | count x (y:ys)
| x == y = Succ (count x ys)
| otherwise = count x ys | 73 | count x (y:ys)
| x == y = Succ (count x ys)
| otherwise = count x ys | 73 | count x (y:ys)
| x == y = Succ (count x ys)
| otherwise = count x ys | 73 | false | false | 1 | 8 | 22 | 53 | 24 | 29 | null | null |
ghorn/ois-input-manager | src/Key.hs | bsd-3-clause | decodeKey 26 = KC_LBRACKET | 26 | decodeKey 26 = KC_LBRACKET | 26 | decodeKey 26 = KC_LBRACKET | 26 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
ghcjs/jsaddle-dom | src/JSDOM/Generated/HTMLOptionsCollection.hs | mit | -- | <https://developer.mozilla.org/en-US/docs/Web/API/HTMLOptionsCollection.namedItem Mozilla HTMLOptionsCollection.namedItem documentation>
namedItem_ ::
(MonadDOM m, ToJSString name) =>
HTMLOptionsCollection -> name -> m ()
namedItem_ self name = liftDOM (void (self ! name)) | 303 | namedItem_ ::
(MonadDOM m, ToJSString name) =>
HTMLOptionsCollection -> name -> m ()
namedItem_ self name = liftDOM (void (self ! name)) | 160 | namedItem_ self name = liftDOM (void (self ! name)) | 51 | true | true | 0 | 9 | 52 | 61 | 31 | 30 | null | null |
foreverbell/project-euler-solutions | src/45.hs | bsd-3-clause | pentagonal = [ n * (3 * n - 1) `div` 2 | n <- [1 .. ] ] | 55 | pentagonal = [ n * (3 * n - 1) `div` 2 | n <- [1 .. ] ] | 55 | pentagonal = [ n * (3 * n - 1) `div` 2 | n <- [1 .. ] ] | 55 | false | false | 0 | 10 | 18 | 42 | 24 | 18 | null | null |
DougBurke/swish | src/Swish/RDF/ProofContext.hs | lgpl-2.1 | rdfsa29 :: RDFFormula
rdfsa29 = makeFormula scopeRDFS "a29"
"rdfs:comment rdfs:range rdfs:Literal ." | 111 | rdfsa29 :: RDFFormula
rdfsa29 = makeFormula scopeRDFS "a29"
"rdfs:comment rdfs:range rdfs:Literal ." | 111 | rdfsa29 = makeFormula scopeRDFS "a29"
"rdfs:comment rdfs:range rdfs:Literal ." | 89 | false | true | 0 | 5 | 22 | 19 | 9 | 10 | null | null |
avieth/InvertibleSyntax | Examples/Stack.hs | bsd-3-clause | invsynSequenceSemicolon
:: InvertibleSyntax String Identity (left h s ()) (left h s ())
-> InvertibleSyntax String Identity (right h s t) (right h s t)
-> InvertibleSyntax String Identity (Sequence left right h s t) (Sequence left right h s t)
invsynSequenceSemicolon left right = do
l <- lmap getLeft left
optional (many1 (char ' '))
char ';'
optional (many1 (char ' '))
pretty (char '\n')
r <- lmap getRight right
return (Sequence l r)
where
getLeft :: Sequence left right h s t -> left h s ()
getLeft term = case term of
Sequence left _ -> left
getRight :: Sequence left right h s t -> right h s t
getRight term = case term of
Sequence _ right -> right | 729 | invsynSequenceSemicolon
:: InvertibleSyntax String Identity (left h s ()) (left h s ())
-> InvertibleSyntax String Identity (right h s t) (right h s t)
-> InvertibleSyntax String Identity (Sequence left right h s t) (Sequence left right h s t)
invsynSequenceSemicolon left right = do
l <- lmap getLeft left
optional (many1 (char ' '))
char ';'
optional (many1 (char ' '))
pretty (char '\n')
r <- lmap getRight right
return (Sequence l r)
where
getLeft :: Sequence left right h s t -> left h s ()
getLeft term = case term of
Sequence left _ -> left
getRight :: Sequence left right h s t -> right h s t
getRight term = case term of
Sequence _ right -> right | 729 | invsynSequenceSemicolon left right = do
l <- lmap getLeft left
optional (many1 (char ' '))
char ';'
optional (many1 (char ' '))
pretty (char '\n')
r <- lmap getRight right
return (Sequence l r)
where
getLeft :: Sequence left right h s t -> left h s ()
getLeft term = case term of
Sequence left _ -> left
getRight :: Sequence left right h s t -> right h s t
getRight term = case term of
Sequence _ right -> right | 473 | false | true | 0 | 11 | 197 | 325 | 150 | 175 | null | null |
DeathByTape/LifeRaft | test/Network/LifeRaft/Internal/NetworkHelperSpec.hs | bsd-3-clause | getConnectedSockets :: IO (Socket, Socket)
getConnectedSockets = do
listener <- socket AF_INET Stream defaultProtocol
rightSock <- socket AF_INET Stream defaultProtocol
hAddr <- getSockAddr "localhost:1" >>= \saddr -> case saddr of
Nothing -> fail "Could not get SockAddr for localhost."
Just (SockAddrInet _ host) -> return host
_ -> fail "Returned unexpected SockAddr type."
bind listener $ SockAddrInet aNY_PORT hAddr
listen listener 5
port <- socketPort listener
-- Start server asynchronously
serverFuture <- async $ do
(sock, _) <- accept listener
return sock
-- Make the connection
connect rightSock $ SockAddrInet port hAddr
leftSock <- wait serverFuture
sClose listener
return (leftSock, rightSock)
-- | Close a pair of sockets
-- | 786 | getConnectedSockets :: IO (Socket, Socket)
getConnectedSockets = do
listener <- socket AF_INET Stream defaultProtocol
rightSock <- socket AF_INET Stream defaultProtocol
hAddr <- getSockAddr "localhost:1" >>= \saddr -> case saddr of
Nothing -> fail "Could not get SockAddr for localhost."
Just (SockAddrInet _ host) -> return host
_ -> fail "Returned unexpected SockAddr type."
bind listener $ SockAddrInet aNY_PORT hAddr
listen listener 5
port <- socketPort listener
-- Start server asynchronously
serverFuture <- async $ do
(sock, _) <- accept listener
return sock
-- Make the connection
connect rightSock $ SockAddrInet port hAddr
leftSock <- wait serverFuture
sClose listener
return (leftSock, rightSock)
-- | Close a pair of sockets
-- | 786 | getConnectedSockets = do
listener <- socket AF_INET Stream defaultProtocol
rightSock <- socket AF_INET Stream defaultProtocol
hAddr <- getSockAddr "localhost:1" >>= \saddr -> case saddr of
Nothing -> fail "Could not get SockAddr for localhost."
Just (SockAddrInet _ host) -> return host
_ -> fail "Returned unexpected SockAddr type."
bind listener $ SockAddrInet aNY_PORT hAddr
listen listener 5
port <- socketPort listener
-- Start server asynchronously
serverFuture <- async $ do
(sock, _) <- accept listener
return sock
-- Make the connection
connect rightSock $ SockAddrInet port hAddr
leftSock <- wait serverFuture
sClose listener
return (leftSock, rightSock)
-- | Close a pair of sockets
-- | 743 | false | true | 0 | 15 | 155 | 222 | 101 | 121 | null | null |
tjakway/ghcjvm | compiler/specialise/Rules.hs | bsd-3-clause | ruleCheck _ (Coercion _) = emptyBag | 38 | ruleCheck _ (Coercion _) = emptyBag | 38 | ruleCheck _ (Coercion _) = emptyBag | 38 | false | false | 1 | 6 | 8 | 20 | 8 | 12 | null | null |
exitmouse/proper | src/Visnov.hs | gpl-3.0 | pose :: String -> Dialogue u ()
pose s = Dialogue $ do
character <- ask
lift $ setPose character s | 102 | pose :: String -> Dialogue u ()
pose s = Dialogue $ do
character <- ask
lift $ setPose character s | 102 | pose s = Dialogue $ do
character <- ask
lift $ setPose character s | 70 | false | true | 0 | 9 | 24 | 48 | 22 | 26 | null | null |
freizl/freizl.github.com-old | src/Hakyll/Core/Compiler/Require.hs | bsd-3-clause | --------------------------------------------------------------------------------
save :: (Binary a, Typeable a) => Store -> Item a -> IO ()
save store item = saveSnapshot store final item | 187 | save :: (Binary a, Typeable a) => Store -> Item a -> IO ()
save store item = saveSnapshot store final item | 106 | save store item = saveSnapshot store final item | 47 | true | true | 0 | 9 | 22 | 55 | 27 | 28 | null | null |
input-output-hk/rscoin-haskell | src/RSCoin/Explorer/Web/Sockets/App.hs | gpl-3.0 | unsubscribeFully
:: MonadState ConnectionsState m
=> SessionId -> m ()
unsubscribeFully i = unsubscribeHBlocks i >> unsubscribeAddr i | 141 | unsubscribeFully
:: MonadState ConnectionsState m
=> SessionId -> m ()
unsubscribeFully i = unsubscribeHBlocks i >> unsubscribeAddr i | 141 | unsubscribeFully i = unsubscribeHBlocks i >> unsubscribeAddr i | 62 | false | true | 0 | 8 | 25 | 45 | 20 | 25 | null | null |
BartAdv/Idris-dev | src/Idris/Reflection.hs | bsd-3-clause | fromTTMaybe :: Term -> Maybe Term -- WARNING: Assumes the term has type Maybe a
fromTTMaybe (App _ (App _ (P (DCon _ _ _) (NS (UN just) _) _) ty) tm)
| just == txt "Just" = Just tm | 182 | fromTTMaybe :: Term -> Maybe Term
fromTTMaybe (App _ (App _ (P (DCon _ _ _) (NS (UN just) _) _) ty) tm)
| just == txt "Just" = Just tm | 136 | fromTTMaybe (App _ (App _ (P (DCon _ _ _) (NS (UN just) _) _) ty) tm)
| just == txt "Just" = Just tm | 102 | true | true | 0 | 15 | 41 | 92 | 44 | 48 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.