Skip to content

Commit

Permalink
Source file renaming, import ordering, soundness exports
Browse files Browse the repository at this point in the history
  • Loading branch information
propensive committed Jun 12, 2024
1 parent af02081 commit c2bd1f2
Show file tree
Hide file tree
Showing 15 changed files with 777 additions and 555 deletions.
478 changes: 478 additions & 0 deletions src/core/hypotenuse-core.scala

Large diffs are not rendered by default.

31 changes: 31 additions & 0 deletions src/core/hypotenuse.CheckOverflow.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
Hypotenuse, version [unreleased]. Copyright 2024 Jon Pretty, Propensive OÜ.
The primary distribution site is: https://propensive.com/
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied. See the License for the specific language governing permissions
and limitations under the License.
*/

package hypotenuse

import language.experimental.genericNumberLiterals
import language.experimental.into

trait CheckOverflow:
type Wrap[ResultType]
inline def addU64(left: U64, right: U64): Wrap[U64]
inline def addI64(left: I64, right: I64): Wrap[I64]
inline def addU32(left: U32, right: U32): Wrap[U32]
inline def addI32(left: I32, right: I32): Wrap[I32]
inline def addU16(left: U16, right: U16): Wrap[U16]
inline def addI16(left: I16, right: I16): Wrap[I16]
inline def addU8(left: U8, right: U8): Wrap[U8]
inline def addI8(left: I8, right: I8): Wrap[I8]
24 changes: 24 additions & 0 deletions src/core/hypotenuse.CompareGreater.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
Hypotenuse, version [unreleased]. Copyright 2024 Jon Pretty, Propensive OÜ.
The primary distribution site is: https://propensive.com/
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied. See the License for the specific language governing permissions
and limitations under the License.
*/

package hypotenuse

import language.experimental.captureChecking

import scala.annotation.*

trait CompareGreater[-LeftType, -RightType, +ResultType] extends NumericallyComparable:
inline def greaterThan(inline left: LeftType, inline right: RightType): ResultType
24 changes: 24 additions & 0 deletions src/core/hypotenuse.CompareGreaterEqual.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
Hypotenuse, version [unreleased]. Copyright 2024 Jon Pretty, Propensive OÜ.
The primary distribution site is: https://propensive.com/
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied. See the License for the specific language governing permissions
and limitations under the License.
*/

package hypotenuse

import language.experimental.captureChecking

import scala.annotation.*

trait CompareGreaterEqual[-LeftType, -RightType, +ResultType] extends NumericallyComparable:
inline def greaterThanOrEqual(inline left: LeftType, inline right: RightType): ResultType
24 changes: 24 additions & 0 deletions src/core/hypotenuse.CompareLess.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
Hypotenuse, version [unreleased]. Copyright 2024 Jon Pretty, Propensive OÜ.
The primary distribution site is: https://propensive.com/
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied. See the License for the specific language governing permissions
and limitations under the License.
*/

package hypotenuse

import language.experimental.captureChecking

import scala.annotation.*

trait CompareLess[-LeftType, -RightType, +ResultType] extends NumericallyComparable:
inline def lessThan(inline left: LeftType, inline right: RightType): ResultType
24 changes: 24 additions & 0 deletions src/core/hypotenuse.CompareLessEqual.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
Hypotenuse, version [unreleased]. Copyright 2024 Jon Pretty, Propensive OÜ.
The primary distribution site is: https://propensive.com/
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied. See the License for the specific language governing permissions
and limitations under the License.
*/

package hypotenuse

import language.experimental.captureChecking

import scala.annotation.*

trait CompareLessEqual[-LeftType, -RightType, +ResultType] extends NumericallyComparable:
inline def lessThanOrEqual(inline left: LeftType, inline right: RightType): ResultType
30 changes: 30 additions & 0 deletions src/core/hypotenuse.DivisionByZero.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
Hypotenuse, version [unreleased]. Copyright 2024 Jon Pretty, Propensive OÜ.
The primary distribution site is: https://propensive.com/
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied. See the License for the specific language governing permissions
and limitations under the License.
*/

package hypotenuse

import language.experimental.into

trait DivisionByZero:
type Wrap[ResultType]
inline def divideU64(left: U64, right: U64): Wrap[U64]
inline def divideI64(left: I64, right: I64): Wrap[I64]
inline def divideU32(left: U32, right: U32): Wrap[U32]
inline def divideI32(left: I32, right: I32): Wrap[I32]
inline def divideU16(left: U16, right: U16): Wrap[U16]
inline def divideI16(left: I16, right: I16): Wrap[I16]
inline def divideU8(left: U8, right: U8): Wrap[U8]
inline def divideI8(left: I8, right: I8): Wrap[I8]
23 changes: 23 additions & 0 deletions src/core/hypotenuse.DivisionError.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
Hypotenuse, version [unreleased]. Copyright 2024 Jon Pretty, Propensive OÜ.
The primary distribution site is: https://propensive.com/
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied. See the License for the specific language governing permissions
and limitations under the License.
*/

package hypotenuse

import language.experimental.into

import fulminate.*

case class DivisionError() extends Error(msg"the result is unrepresentable")
Loading

0 comments on commit c2bd1f2

Please sign in to comment.