Safe Haskell | None |
---|---|

Language | Haskell98 |

- findConversion :: Commodity -> Commodity -> UTCTime -> CommodityMap -> Maybe (UTCTime, Rational)
- addConversion :: Commodity -> Commodity -> UTCTime -> Rational -> State CommodityMap ()
- intAStar :: (Ord c, Num c) => (Key -> IntMap c) -> (Key -> c) -> (Key -> Bool) -> Key -> Maybe [Key]
- intAStarM :: (Monad m, Ord c, Num c) => (Key -> m (IntMap c)) -> (Key -> m c) -> (Key -> m Bool) -> m Key -> m (Maybe [Key])

# Documentation

:: Commodity | Source commodity |

-> Commodity | Target commodity |

-> UTCTime | Look for conversions on or before this |

-> CommodityMap | Set of commodities to search |

-> Maybe (UTCTime, Rational) |

Lookup a price conversion from the source commodity to the target, using data from the given time or earlier. Result is Nothing if no conversion can be found, or else the best conversion ratio plus the time of the oldest link.

addConversion :: Commodity -> Commodity -> UTCTime -> Rational -> State CommodityMap () Source #

Add a price conversion in the form of a ratio between two commodities at a specific point in time.

:: (Ord c, Num c) | |

=> (Key -> IntMap c) | The graph we are searching through, given as a function from vertices to their neighbours. |

-> (Key -> c) | Heuristic distance to the (nearest) goal. This should never overestimate the distance, or else the path found may not be minimal. |

-> (Key -> Bool) | The goal, specified as a boolean predicate on vertices. |

-> Key | The vertex to start searching from. |

-> Maybe [Key] | An optimal path, if any path exists. This excludes the starting vertex. |

This function computes an optimal (minimal distance) path through a graph in a best-first fashion, starting from a given starting point.

:: (Monad m, Ord c, Num c) | |

=> (Key -> m (IntMap c)) | The graph we are searching through, given as a function from vertices to their neighbours. |

-> (Key -> m c) | Heuristic distance to the (nearest) goal. This should never overestimate the distance, or else the path found may not be minimal. |

-> (Key -> m Bool) | The goal, specified as a boolean predicate on vertices. |

-> m Key | The vertex to start searching from. |

-> m (Maybe [Key]) | An optimal path, if any path exists. This excludes the starting vertex. |

This function computes an optimal (minimal distance) path through a graph in a best-first fashion, starting from a given starting point.