Skip to content

Commit

Permalink
add type annotations everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianHicks committed May 10, 2021
1 parent a493fe9 commit 46063ac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/Database.elm
Expand Up @@ -370,6 +370,7 @@ filterWithResultHelp done filter todo =
rowMatchesSelection : Selection -> Row -> Result Problem Bool
rowMatchesSelection selection row =
let
lookup : Field -> Result Problem Constant
lookup field =
case Array.get field row of
Just constant ->
Expand All @@ -378,6 +379,7 @@ rowMatchesSelection selection row =
Nothing ->
Err (UnknownFields [ field ])

resolve : FieldOrConstant -> Result Problem Constant
resolve fieldOrConstant =
case fieldOrConstant of
Field field ->
Expand Down
5 changes: 4 additions & 1 deletion src/Datalog.elm
Expand Up @@ -2,7 +2,7 @@ module Datalog exposing (Atom, BodyAtom, Database, Problem(..), Rule, Term, atom

import Database exposing (Constant)
import Dict exposing (Dict)
import Graph exposing (Edge, Node)
import Graph exposing (Edge, Graph, Node)
import List.Extra exposing (foldrResult, indexOf)
import Murmur3
import Set
Expand Down Expand Up @@ -99,9 +99,11 @@ query rules (Database db) =
)
rules

graph : Graph String ()
graph =
Graph.fromNodesAndEdges nodes edges

strata : List (Graph String ())
strata =
case Graph.stronglyConnectedComponents graph of
Ok _ ->
Expand Down Expand Up @@ -164,6 +166,7 @@ rule =
ruleToPlan : Rule -> Result Problem Database.QueryPlan
ruleToPlan (Rule (Atom _ headTerms) bodyAtoms) =
let
planned : Result Problem ( List String, Database.QueryPlan )
planned =
case bodyAtoms of
[] ->
Expand Down

0 comments on commit 46063ac

Please sign in to comment.