From 78279a12b8ddd3573f6036d38b34528121abd83b Mon Sep 17 00:00:00 2001 From: Peter Lebbing Date: Thu, 3 Oct 2024 17:01:08 +0200 Subject: [PATCH] Declare fixity of exponentiation (Clash.Class.Exp) --- changelog/2024-10-03T17_02_19+02_00_exp_fixity | 1 + clash-prelude/src/Clash/Class/Exp.hs | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 changelog/2024-10-03T17_02_19+02_00_exp_fixity diff --git a/changelog/2024-10-03T17_02_19+02_00_exp_fixity b/changelog/2024-10-03T17_02_19+02_00_exp_fixity new file mode 100644 index 0000000000..df3a8b08e9 --- /dev/null +++ b/changelog/2024-10-03T17_02_19+02_00_exp_fixity @@ -0,0 +1 @@ +FIXED: Exponentiation (`Clash.Class.Exp`) now binds as `infixr 8` instead of the implicit `infixl 9` which resulted from forgetting to specify the fixity. diff --git a/clash-prelude/src/Clash/Class/Exp.hs b/clash-prelude/src/Clash/Class/Exp.hs index 9d25f0e294..aff559b4d7 100644 --- a/clash-prelude/src/Clash/Class/Exp.hs +++ b/clash-prelude/src/Clash/Class/Exp.hs @@ -1,7 +1,8 @@ {-| Copyright : (C) 2019, Myrtle Software Ltd + 2024, QBayLogic B.V. License : BSD2 (see the file LICENSE) -Maintainer : Christiaan Baaij +Maintainer : QBayLogic B.V. -} {-# LANGUAGE CPP #-} @@ -38,6 +39,8 @@ class Exp a where -> ExpResult a n -- ^ Resized result, guaranteed to not have overflown +infixr 8 ^ + instance KnownNat m => Exp (Index m) where type ExpResult (Index m) n = Index (Max 2 (m ^ n))