From 7eb16b4782c72caa53f667d22fa97a26b131ed72 Mon Sep 17 00:00:00 2001 From: sheaf Date: Thu, 15 Jun 2023 00:39:03 +0200 Subject: [PATCH] tiny build fixes --- shell.nix | 4 +--- src/splines/Math/Interval/Internal.hs | 12 +++++------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/shell.nix b/shell.nix index 2232801..50d90ce 100644 --- a/shell.nix +++ b/shell.nix @@ -1,9 +1,7 @@ let pkgs = import {}; in with pkgs; pkgs.mkShell { packages = - [ haskell.packages.ghc943.ghc - cabal-install - zlib + [ zlib pkg-config gobject-introspection gtk4 diff --git a/src/splines/Math/Interval/Internal.hs b/src/splines/Math/Interval/Internal.hs index 31a135d..41a57c9 100644 --- a/src/splines/Math/Interval/Internal.hs +++ b/src/splines/Math/Interval/Internal.hs @@ -6,7 +6,7 @@ {-# OPTIONS_GHC -Wno-orphans #-} module Math.Interval.Internal - ( 𝕀(𝕀), inf, sup, scaleInterval ) + ( 𝕀(𝕀, inf, sup), scaleInterval ) where -- base @@ -155,19 +155,17 @@ newtype 𝕀 a = MkI { ival :: Interval.Interval a } {-# COMPLETE 𝕀 #-} pattern 𝕀 :: a -> a -> 𝕀 a -pattern 𝕀 x y = MkI ( Interval.I ( Rounded x ) ( Rounded y ) ) - -inf, sup :: 𝕀 a -> a -inf (𝕀 a _) = a -sup (𝕀 _ b) = b +pattern 𝕀 { inf, sup } = MkI ( Interval.I ( Rounded inf ) ( Rounded sup ) ) instance Ring ( 𝕀 Double ) where MkI i1 * MkI i2 = MkI $ i1 Prelude.* i2 - MkI x ^ n = MkI $ Interval.powInt x ( Prelude.fromIntegral n ) + MkI x ^ n = MkI { ival = Interval.powInt x ( Prelude.fromIntegral n ) } -- This is very important, as x^2 is not the same as x * x -- in interval arithmetic. This ensures we don't -- accidentally use (^) from Prelude. +deriving via ViaPrelude ( 𝕀 Double ) + instance Floating ( 𝕀 Double ) deriving via ViaPrelude ( 𝕀 Double ) instance Transcendental ( 𝕀 Double )