Skip to content

Commit

Permalink
Add Finite class
Browse files Browse the repository at this point in the history
  • Loading branch information
kleinreact committed Jan 1, 2025
1 parent e1235bd commit 7a1399a
Show file tree
Hide file tree
Showing 13 changed files with 1,028 additions and 13 deletions.
1 change: 1 addition & 0 deletions changelog/2024-12-30T13_36_39+01_00_add_finite_class
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ADDED: Added `Clash.Class.Finite.Finite`: a class for types with only finitely many inhabitants. The class can be considered a more hardware-friendly alternative to `Bounded` and `Enum`, utilizing 'Index' instead of `Int` and vectors instead of lists.
6 changes: 5 additions & 1 deletion clash-prelude/clash-prelude.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Maintainer: QBayLogic B.V. <[email protected]>
Copyright: Copyright © 2013-2016, University of Twente,
2016-2017, Myrtle Software Ltd,
2017-2019, QBayLogic B.V., Google Inc.,
2021-2023, QBayLogic B.V.
2021-2025, QBayLogic B.V.
Category: Hardware
Build-type: Simple

Expand Down Expand Up @@ -183,6 +183,10 @@ Library
Clash.Class.Counter.Internal
Clash.Class.Counter.TH
Clash.Class.Exp
Clash.Class.Finite
Clash.Class.Finite.Internal
Clash.Class.Finite.Internal.Dictionaries
Clash.Class.Finite.Internal.TH
Clash.Class.HasDomain
Clash.Class.HasDomain.HasSingleDomain
Clash.Class.HasDomain.HasSpecificDomain
Expand Down
18 changes: 18 additions & 0 deletions clash-prelude/src/Clash/Class/Finite.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{-|
Copyright : (C) 2024-2025, QBayLogic B.V.
License : BSD2 (see the file LICENSE)
Maintainer : QBayLogic B.V. <[email protected]>
-}

module Clash.Class.Finite
( -- * Finite Class
Finite(..)
-- * Extensions
, ReversedIndexOrder(..)
, WithUndefined(..)
-- * Deriving Helpers
, FiniteDerive(..)
)
where

import Clash.Class.Finite.Internal
Loading

0 comments on commit 7a1399a

Please sign in to comment.