Created
March 31, 2018 09:05
-
-
Save sameei/8d1a341a911b2ff58df25628e2a53d2b to your computer and use it in GitHub Desktop.
SARF Abstraction
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| object SARFAbstraction { self ⇒ | |
| trait Frame { | |
| type Tracked | |
| type Untracked | |
| type TrackingCode | |
| def apply(untracked: Untracked, trackingCode: TrackingCode): Tracked | |
| def apply(tracked: Tracked): (Untracked, TrackingCode) | |
| } | |
| sealed trait Channel { | |
| type Frame <: self.Frame | |
| } | |
| trait Source extends Channel | |
| trait Sink extends Channel | |
| trait TypeInfo[T] { | |
| def string(t: T): String | |
| def name: String | |
| } | |
| trait TypeTool[T, F <: Frame] { | |
| def frame(t: T): F#Untracked | |
| def unframe(f: F#Untracked): T | |
| } | |
| trait FunctionDef[In, Out] { | |
| type InFrame <: Frame | |
| type OutFrame <: Frame | |
| type Src <: Source # { type Frame <: InFrame } | |
| type Snk <: Sink # { type Frame <: OutFrame } | |
| def typeInfoOfIn: TypeInfo[In] | |
| def typeToolOfIn: TypeTool[In, InFrame] | |
| def typeInfoOfOut: TypeInfo[Out] | |
| def typeToolOfOut: TypeTool[Out, OutFrame] | |
| def apply(in: In): Out | |
| } | |
| trait Service | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment