tiny build fixes

This commit is contained in:
sheaf 2023-06-15 00:39:03 +02:00
parent 96aa38b3c3
commit 7eb16b4782
2 changed files with 6 additions and 10 deletions

View file

@ -1,9 +1,7 @@
let pkgs = import <nixpkgs> {}; let pkgs = import <nixpkgs> {};
in with pkgs; pkgs.mkShell in with pkgs; pkgs.mkShell
{ packages = { packages =
[ haskell.packages.ghc943.ghc [ zlib
cabal-install
zlib
pkg-config pkg-config
gobject-introspection gobject-introspection
gtk4 gtk4

View file

@ -6,7 +6,7 @@
{-# OPTIONS_GHC -Wno-orphans #-} {-# OPTIONS_GHC -Wno-orphans #-}
module Math.Interval.Internal module Math.Interval.Internal
( 𝕀(𝕀), inf, sup, scaleInterval ) ( 𝕀(𝕀, inf, sup), scaleInterval )
where where
-- base -- base
@ -155,19 +155,17 @@ newtype 𝕀 a = MkI { ival :: Interval.Interval a }
{-# COMPLETE 𝕀 #-} {-# COMPLETE 𝕀 #-}
pattern 𝕀 :: a -> a -> 𝕀 a pattern 𝕀 :: a -> a -> 𝕀 a
pattern 𝕀 x y = MkI ( Interval.I ( Rounded x ) ( Rounded y ) ) pattern 𝕀 { inf, sup } = MkI ( Interval.I ( Rounded inf ) ( Rounded sup ) )
inf, sup :: 𝕀 a -> a
inf (𝕀 a _) = a
sup (𝕀 _ b) = b
instance Ring ( 𝕀 Double ) where instance Ring ( 𝕀 Double ) where
MkI i1 * MkI i2 = MkI $ i1 Prelude.* i2 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 -- This is very important, as x^2 is not the same as x * x
-- in interval arithmetic. This ensures we don't -- in interval arithmetic. This ensures we don't
-- accidentally use (^) from Prelude. -- accidentally use (^) from Prelude.
deriving via ViaPrelude ( 𝕀 Double )
instance Floating ( 𝕀 Double )
deriving via ViaPrelude ( 𝕀 Double ) deriving via ViaPrelude ( 𝕀 Double )
instance Transcendental ( 𝕀 Double ) instance Transcendental ( 𝕀 Double )