Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Cloogle
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Cloogle
Cloogle
Commits
2b6446a6
Verified
Commit
2b6446a6
authored
Nov 18, 2018
by
Camil Staps
🚀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cache requests while resolving ranking constraints
parent
a2a620fa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
6 deletions
+17
-6
Cloogle/Search/Rank.icl
Cloogle/Search/Rank.icl
+17
-6
No files found.
Cloogle/Search/Rank.icl
View file @
2b6446a6
...
...
@@ -13,6 +13,8 @@ import Data.Error
from
Data
.
Foldable
import
class
Foldable
(
foldr1
)
from
Data
.
Func
import
$
import
Data
.
Functor
from
Data
.
GenLexOrd
import
::
LexOrd
,
generic
gLexOrd
import
qualified
Data
.
GenLexOrd
from
Data
.
List
import
instance
Foldable
[]
import
qualified
Data
.
Map
as
M
import
Data
.
Maybe
...
...
@@ -160,7 +162,7 @@ where
rankConstraints
::
![(
Request
,
RankConstraint
)]
!*
CloogleDB
->
*([
String
],
*
CloogleDB
)
rankConstraints
constraints
cdb
#
(
constraints
,
cdb
)
=
findConstraints
constraints
cdb
#
(
constraints
,
cdb
)
=
findConstraints
constraints
'M'
.
newMap
cdb
=
(
default
++
constraints
,
cdb
)
where
default
=
...
...
@@ -178,16 +180,25 @@ where
,
"(declare-const rs_lib_stdenv Real)"
]
findConstraints
::
![(
Request
,
RankConstraint
)]
!*
CloogleDB
->
*([
String
],
*
CloogleDB
)
findConstraints
[(
req
,
LT
urid1
urid2
):
rest
]
cdb
#
(
orgsearchtype
,
allsyns
,
usedsyns
,
entries
,
cdb
)
=
search`
req
cdb
derive
gLexOrd
Request
,
Maybe
instance
<
Request
where
<
a
b
=
(
gLexOrd
{|*|}
a
b
)=:'
Data
.
GenLexOrd
'.
LT
findConstraints
::
![(
Request
,
RankConstraint
)]
!(
Map
Request
(!
Maybe
Type
,!
Map
String
[
TypeDef
],![
TypeDef
],![(!
CloogleEntry
,![
Annotation
])]))
!*
CloogleDB
->
*([
String
],
*
CloogleDB
)
findConstraints
[(
req
,
LT
urid1
urid2
):
rest
]
results
cdb
#
(
orgsearchtype
,
allsyns
,
usedsyns
,
entries
,
cdb
)
=
case
'M'
.
get
req
results
of
Just
(
t
,
as
,
us
,
es
)
->
(
t
,
as
,
us
,
es
,
cdb
)
_
->
search`
req
cdb
#
results
=
'M'
.
put
req
(
orgsearchtype
,
allsyns
,
usedsyns
,
entries
)
results
#
(
e1
,
annots1
,
cdb
)
=
findEntry
orgsearchtype
allsyns
usedsyns
urid1
entries
cdb
#
(
e2
,
annots2
,
cdb
)
=
findEntry
orgsearchtype
allsyns
usedsyns
urid2
entries
cdb
#
ri1
=
symbolicDistance
e1
annots1
#
ri2
=
symbolicDistance
e2
annots2
#
this
=
"(assert (< ("
+++
formula
ri1
+++
") ("
+++
formula
ri2
+++
")))"
#
cdb
=
resetDB
cdb
#
(
rest
,
cdb
)
=
findConstraints
rest
cdb
#
(
rest
,
cdb
)
=
findConstraints
rest
results
cdb
=
([
this
:
rest
],
cdb
)
where
findEntry
orgsearchtype
allsyns
usedsyns
urid
=:(_,
mod
,
name
)
entries
cdb
...
...
@@ -225,4 +236,4 @@ where
sum
[
t
:
ts
]
#
s
=
sum
ts
=
"+ ("
+++
t
+++
") ("
+++
s
+++
")"
findConstraints
[]
cdb
=
([],
cdb
)
findConstraints
[]
_
cdb
=
([],
cdb
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment