{-# LANGUAGE UnicodeSyntax, FlexibleContexts #-} module GraphRewriting.GL.HyperEdge where import GraphRewriting.Graph import GraphRewriting.Graph.Read import GraphRewriting.Layout.Rotation import GraphRewriting.Layout.Position import GraphRewriting.Layout.PortSpec import GraphRewriting.Layout.RotPortSpec type HyperEdgeRepr n = Edge → [n] → [(Vector2, Vector2)] star ∷ (View [Port] n, View Position n, PortSpec n, View Rotation n) ⇒ HyperEdgeRepr n star :: forall n. (View [Port] n, View Position n, PortSpec n, View Rotation n) => HyperEdgeRepr n star Port e [n] ns = [(Vector2 port, [Vector2] -> Vector2 focalPoint [Vector2] ports) | Vector2 port ← [Vector2] ports] where ports :: [Vector2] ports = (n -> [Vector2]) -> [n] -> [Vector2] forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b] concatMap ((n -> [Vector2]) -> Port -> n -> [Vector2] forall n a. View [Port] n => (n -> [a]) -> Port -> n -> [a] propOfPort n -> [Vector2] forall n. (PortSpec n, View Position n, View Rotation n) => n -> [Vector2] absRotPortPos Port e) [n] ns complete ∷ (View Position n, PortSpec n, View Rotation n) ⇒ Edge → [n] → [(Vector2, Vector2)] complete :: forall n. (View Position n, PortSpec n, View Rotation n) => Port -> [n] -> [(Vector2, Vector2)] complete = Port -> [n] -> [(Vector2, Vector2)] forall a. HasCallStack => a undefined