-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
105 additions
and
72 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
11 changes: 0 additions & 11 deletions
11
modules/imaging/src/main/scala/instances/FieldOfViewInstances.scala
This file was deleted.
Oops, something went wrong.
35 changes: 35 additions & 0 deletions
35
modules/imaging/src/main/scala/instances/FieldOfViewLikeInstances.scala
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package at.ac.oeaw.imba.gerlich.gerlib.imaging | ||
package instances | ||
|
||
import cats.syntax.all.* | ||
|
||
import at.ac.oeaw.imba.gerlich.gerlib.SimpleShow | ||
import at.ac.oeaw.imba.gerlich.gerlib.numeric.NonnegativeInt | ||
import at.ac.oeaw.imba.gerlich.gerlib.numeric.instances.nonnegativeInt.given | ||
import at.ac.oeaw.imba.gerlich.gerlib.syntax.all.* | ||
|
||
/** Typeclass instances for types related to representation of imaging field of | ||
* view | ||
*/ | ||
trait FieldOfViewLikeInstances: | ||
/** Simply show a field of view by the text representation of the underlying | ||
* integer value. | ||
*/ | ||
given SimpleShow[FieldOfView] = | ||
summon[SimpleShow[NonnegativeInt]].contramap(_.get) | ||
|
||
/** Simply show a position name by the underlying value. */ | ||
given SimpleShow[PositionName] = SimpleShow.fromToString | ||
|
||
/** Simply show a general field-of-view-like by distinguishing among the | ||
* subtypes and choosing the appropriate instance. | ||
*/ | ||
given simpleShowForFovLike(using | ||
showFov: SimpleShow[FieldOfView], | ||
showPos: SimpleShow[PositionName] | ||
): SimpleShow[FieldOfViewLike] with | ||
override def show_(fovLike: FieldOfViewLike): String = fovLike match { | ||
case fov: FieldOfView => fov.show_ | ||
case pos: PositionName => pos.show_ | ||
} | ||
end FieldOfViewLikeInstances |
7 changes: 0 additions & 7 deletions
7
modules/imaging/src/main/scala/instances/PositionNameInstances.scala
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...scala/instances/fieldOfView/package.scala → ...a/instances/fieldOfViewLike/package.scala
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package at.ac.oeaw.imba.gerlich.gerlib.imaging | ||
package instances | ||
|
||
package object fieldOfView extends FieldOfViewInstances | ||
package object fieldOfViewLike extends FieldOfViewLikeInstances |
This file contains 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
4 changes: 0 additions & 4 deletions
4
modules/imaging/src/main/scala/instances/positionName/package.scala
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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