Safe Haskell | None |
---|

Simplest and slowest implementation for GraphHammer data structure and analyses combination. It is used for API prototyping. This version is extended with parallel execution of analyses.

- type Index = Int64
- data Nil
- data a :. b
- data GraphHammer as
- graphHammerNew :: HLength as => Int -> Int -> Chan SendReceive -> Array Int32 (Chan (Msg as)) -> IO (GraphHammer as)
- type GraphHammerM as a = StateT (GraphHammer as) IO a
- runAnalysesStack :: (HLength as, EnabledAnalyses as as) => Integer -> Int -> IO (Maybe (UArray Int Index)) -> Analysis as as -> IO ()
- data Value asgn v
- data Composed
- localValue :: (Show v, AnalysisValue v) => v -> AnM as (Value Asgn v)
- cst :: v -> Value Composed v
- ($=) :: (Show v, AnalysisValue v) => Value Asgn v -> Value _a v -> AnM as ()
- (+.) :: (Show v, Num v) => Value _a v -> Value _b v -> Value Composed v
- (-.) :: (Show v, Num v) => Value _a v -> Value _b v -> Value Composed v
- (*.) :: (Show v, Num v) => Value _a v -> Value _b v -> Value Composed v
- divV :: (Integral v, Show v) => Value _a v -> Value _b v -> Value Composed v
- (===) :: (Show v, Eq v) => Value _a v -> Value _b v -> Value Composed Bool
- (=/=) :: (Show v, Eq v) => Value _a v -> Value _b v -> Value Composed Bool
- data Analysis as wholeset
- type AnM as a = State (AnSt as) a
- onEdges :: Value Composed Index -> (Value Composed Index -> AnM as r) -> AnM as r
- anIf :: Value Composed Bool -> AnM as r -> AnM as r -> AnM as r
- getAnalysisResult :: AnalysisIndex a as => a -> Value _a Index -> AnM as (Value Composed Int64)
- putAnalysisResult :: AnalysisIndex a as => a -> Value _a Index -> Value _b Int64 -> AnM as ()
- incrementAnalysisResult :: AnalysisIndex a as => a -> Value _a Index -> Value _b Int64 -> AnM as ()
- type family RequiredAnalyses a
- basicAnalysis :: (RequiredAnalyses a ~ Nil, EnabledAnalysis a wholeset) => a -> (a -> Value Composed Index -> Value Composed Index -> AnM (a :. Nil) ()) -> Analysis (a :. Nil) wholeset
- derivedAnalysis :: (EnabledAnalyses (RequiredAnalyses a) as, EnabledAnalyses as wholeset, EnabledAnalyses (a :. as) wholeset) => Analysis as wholeset -> a -> (a -> Value Composed Index -> Value Composed Index -> AnM (a :. as) ()) -> Analysis (a :. as) wholeset
- class EnabledAnalysis a as
- class EnabledAnalyses as eas

# Documentation

# HList

EnabledAnalysis a as => EnabledAnalysis a (:. a' as) | |

EnabledAnalysis a (:. a as) | |

HLength as => HLength (:. a as) | |

(EnabledAnalyses as eas, EnabledAnalysis a eas) => EnabledAnalyses (:. a as) eas |

# Representation exported abstractly

data GraphHammer as Source

A representation parametrized by analyses required.

## How to create a new GraphHammer.

:: HLength as | |

=> Int | Max job nodes |

-> Int | Node index |

-> Chan SendReceive | |

-> Array Int32 (Chan (Msg as)) | |

-> IO (GraphHammer as) |

Create a GraphHammer structure for parallel GraphHammer processing.

## An analysis monad to create operations with GraphHammer.

type GraphHammerM as a = StateT (GraphHammer as) IO aSource

Monad to operate with GraphHammer.

:: (HLength as, EnabledAnalyses as as) | |

=> Integer | |

-> Int | Max number of nodes |

-> IO (Maybe (UArray Int Index)) | Function to obtain edges to insert |

-> Analysis as as | A stack of analyses to perform |

-> IO () |

Run the analyses stack. at this momemt it's possible to run only parallelizable analyses.

## Local values processing.

localValue :: (Show v, AnalysisValue v) => v -> AnM as (Value Asgn v)Source

Define a local value and assign to it.

($=) :: (Show v, AnalysisValue v) => Value Asgn v -> Value _a v -> AnM as ()Source

Assigning a value.

# Analysis type. Abstract.

getAnalysisResult :: AnalysisIndex a as => a -> Value _a Index -> AnM as (Value Composed Int64)Source

Fetch analysis result.

putAnalysisResult :: AnalysisIndex a as => a -> Value _a Index -> Value _b Int64 -> AnM as ()Source

Store analysis result.

incrementAnalysisResult :: AnalysisIndex a as => a -> Value _a Index -> Value _b Int64 -> AnM as ()Source

Update atomically result with increment.

type family RequiredAnalyses a Source

## How to create basic analysis, one which does not depend on the other.

basicAnalysis :: (RequiredAnalyses a ~ Nil, EnabledAnalysis a wholeset) => a -> (a -> Value Composed Index -> Value Composed Index -> AnM (a :. Nil) ()) -> Analysis (a :. Nil) wholesetSource

## Derived analysis, dependent on some other.

derivedAnalysis :: (EnabledAnalyses (RequiredAnalyses a) as, EnabledAnalyses as wholeset, EnabledAnalyses (a :. as) wholeset) => Analysis as wholeset -> a -> (a -> Value Composed Index -> Value Composed Index -> AnM (a :. as) ()) -> Analysis (a :. as) wholesetSource

class EnabledAnalysis a as Source

EnabledAnalysis a as => EnabledAnalysis a (:. a' as) | |

EnabledAnalysis a (:. a as) |

class EnabledAnalyses as eas Source

EnabledAnalyses Nil eas | |

(EnabledAnalyses as eas, EnabledAnalysis a eas) => EnabledAnalyses (:. a as) eas |