Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Declare fixity of exponentiation (Clash.Class.Exp) #2818

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/2024-10-03T17_02_19+02_00_exp_fixity
Original file line number Diff line number Diff line change
@@ -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.
5 changes: 4 additions & 1 deletion clash-prelude/src/Clash/Class/Exp.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{-|
Copyright : (C) 2019, Myrtle Software Ltd
2024, QBayLogic B.V.
License : BSD2 (see the file LICENSE)
Maintainer : Christiaan Baaij <christiaan.baaij@gmail.com>
Maintainer : QBayLogic B.V. <devops@qaylogic.com>
-}

{-# LANGUAGE CPP #-}
Expand Down Expand Up @@ -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))

Expand Down