@@ -138,7 +138,7 @@ module Clash.Signal.Internal
138
138
, resetGen
139
139
, resetGenN
140
140
-- * Boolean connectives
141
- , (.&&.) , (. ||.)
141
+ , (.&&.) , (&&.) , (.&&) , (. ||.) , (||.) , (.|| )
142
142
-- * Simulation functions (not synthesizable)
143
143
, simulate
144
144
-- ** lazy version
@@ -157,9 +157,9 @@ module Clash.Signal.Internal
157
157
, testFor
158
158
-- * Type classes
159
159
-- ** 'Eq'-like
160
- , (.==.) , (./=.)
160
+ , (.==.) , (.==) , (==.) , (./=.) , (./=) , ( /=.)
161
161
-- ** 'Ord'-like
162
- , (.<.) , (.<=.) , (.>=.) , (.>.)
162
+ , (.<.) , (.<) , (<.) , (.< =.) , (.<=) , (<=.) , (. >=.) , (.>=) , (>=.) , (.>.) , (.>) , ( >.)
163
163
-- ** 'Functor'
164
164
, mapSignal #
165
165
-- ** 'Applicative'
@@ -1421,6 +1421,30 @@ infixr 2 .||.
1421
1421
(.||.) :: Applicative f => f Bool -> f Bool -> f Bool
1422
1422
(.||.) = liftA2 (||)
1423
1423
1424
+ infix 2 .||
1425
+ -- | The above type is a generalization for:
1426
+ --
1427
+ -- @
1428
+ -- __(.||)__ :: 'Ord' a => 'Clash.Signal.Signal' Bool -> 'Bool' -> 'Clash.Signal.Signal' 'Bool'
1429
+ -- @
1430
+ --
1431
+ -- It is a version of ('||') that allows comparing a @'Clash.Signal.Signal' Bool@ with a constant
1432
+ -- @Bool@ and returns a 'Clash.Signal.Signal' of 'Bool'
1433
+ (.||) :: Functor f => f Bool -> Bool -> f Bool
1434
+ a .|| b = fmap (|| b) a
1435
+
1436
+ infixr 2 ||.
1437
+ -- | The above type is a generalization for:
1438
+ --
1439
+ -- @
1440
+ -- __(||.)__ :: 'Clash.Signal.Signal' 'Bool' -> 'Clash.Signal.Signal' 'Bool' -> 'Clash.Signal.Signal' 'Bool'
1441
+ -- @
1442
+ --
1443
+ -- It is a version of ('||') that allows comparing a constant @Bool@ with a @'Clash.Signal.Signal' Bool@
1444
+ -- and returns a 'Clash.Signal.Signal' of 'Bool'
1445
+ (||.) :: Functor f => Bool -> f Bool -> f Bool
1446
+ a ||. b = fmap (a || ) b
1447
+
1424
1448
infixr 3 .&&.
1425
1449
-- | The above type is a generalization for:
1426
1450
--
@@ -1432,6 +1456,30 @@ infixr 3 .&&.
1432
1456
(.&&.) :: Applicative f => f Bool -> f Bool -> f Bool
1433
1457
(.&&.) = liftA2 (&&)
1434
1458
1459
+ infixr 3 .&&
1460
+ -- | The above type is a generalization for:
1461
+ --
1462
+ -- @
1463
+ -- __(.&&)__ :: 'Clash.Signal.Signal' 'Bool' -> 'Clash.Signal.Signal' 'Bool' -> 'Clash.Signal.Signal' 'Bool'
1464
+ -- @
1465
+ --
1466
+ -- It is a version of ('&&') that allows comparing a @'Clash.Signal.Signal' Bool@ with a
1467
+ -- constant @Bool@ and returns a 'Clash.Signal.Signal' of 'Bool'
1468
+ (.&&) :: (Functor f ) => f Bool -> Bool -> f Bool
1469
+ (.&&) a b = fmap (&& b) a
1470
+
1471
+ infixr 3 &&.
1472
+ -- | The above type is a generalization for:
1473
+ --
1474
+ -- @
1475
+ -- __(&&.)__ :: 'Clash.Signal.Signal' 'Bool' -> 'Clash.Signal.Signal' 'Bool' -> 'Clash.Signal.Signal' 'Bool'
1476
+ -- @
1477
+ --
1478
+ -- It is a version of ('&&') that allows comparing a constant @'Bool@ with a
1479
+ -- @'Clash.Signal.Signal' Bool@ and returns a 'Clash.Signal.Signal' of 'Bool'
1480
+ (&&.) :: (Functor f ) => Bool -> f Bool -> f Bool
1481
+ (&&.) a b = fmap (a && ) b
1482
+
1435
1483
-- [Note: register strictness annotations]
1436
1484
--
1437
1485
-- In order to produce the first (current) value of the register's output
@@ -1611,6 +1659,30 @@ infix 4 .==.
1611
1659
(.==.) :: (Eq a , Applicative f ) => f a -> f a -> f Bool
1612
1660
(.==.) = liftA2 (==)
1613
1661
1662
+ infix 4 .==
1663
+ -- | The above type is a generalization for:
1664
+ --
1665
+ -- @
1666
+ -- __(.==)__ :: 'Eq' a => 'Clash.Signal.Signal' a -> a -> 'Clash.Signal.Signal' 'Bool'
1667
+ -- @
1668
+ --
1669
+ -- It is a version of ('==') that allows comparing a @'Clash.Signal.Signal' a@ with a
1670
+ -- constant @a@ and returns a 'Clash.Signal.Signal' of 'Bool'
1671
+ (.==) :: (Eq a , Functor f ) => f a -> a -> f Bool
1672
+ (.==) a b = fmap (== b) a
1673
+
1674
+ infix 4 ==.
1675
+ -- | The above type is a generalization for:
1676
+ --
1677
+ -- @
1678
+ -- __(==.)__ :: 'Eq' a => a -> 'Clash.Signal.Signal' a -> 'Clash.Signal.Signal' 'Bool'
1679
+ -- @
1680
+ --
1681
+ -- It is a version of ('==') that allows comparing a @'Clash.Signal.Signal' a@ with a
1682
+ -- constant @a@ and returns a 'Clash.Signal.Signal' of 'Bool'
1683
+ (==.) :: (Eq a , Functor f ) => a -> f a -> f Bool
1684
+ (==.) a b = fmap (a== ) b
1685
+
1614
1686
infix 4 ./=.
1615
1687
-- | The above type is a generalization for:
1616
1688
--
@@ -1622,6 +1694,31 @@ infix 4 ./=.
1622
1694
(./=.) :: (Eq a , Applicative f ) => f a -> f a -> f Bool
1623
1695
(./=.) = liftA2 (/=)
1624
1696
1697
+ infix 4 ./=
1698
+ -- | The above type is a generalization for:
1699
+ --
1700
+ -- @
1701
+ -- __(./=)__ :: 'Eq' a => 'Clash.Signal.Signal' a -> a -> 'Clash.Signal.Signal' 'Bool'
1702
+ -- @
1703
+ --
1704
+ -- It is a version of ('/=') that allows comparing a @'Clash.Signal.Signal' a@ with a
1705
+ -- constant @a@ and returns a 'Clash.Signal.Signal' of 'Bool'
1706
+ (./=) :: (Eq a , Functor f ) => f a -> a -> f Bool
1707
+ (./=) a b = fmap (/= b) a
1708
+
1709
+ infix 4 /=.
1710
+ -- | The above type is a generalization for:
1711
+ --
1712
+ -- @
1713
+ -- __(/=.)__ :: 'Eq' a => a -> 'Clash.Signal.Signal' a -> 'Clash.Signal.Signal' 'Bool'
1714
+ -- @
1715
+ --
1716
+ -- It is a version of ('/=') that allows comparing a @'Clash.Signal.Signal' a@ with a
1717
+ -- constant @a@ and returns a 'Clash.Signal.Signal' of 'Bool'
1718
+
1719
+ (/=.) :: (Eq a , Functor f ) => a -> f a -> f Bool
1720
+ (/=.) a b = fmap (a /= ) b
1721
+
1625
1722
infix 4 .<.
1626
1723
-- | The above type is a generalization for:
1627
1724
--
@@ -1633,6 +1730,30 @@ infix 4 .<.
1633
1730
(.<.) :: (Ord a , Applicative f ) => f a -> f a -> f Bool
1634
1731
(.<.) = liftA2 (<)
1635
1732
1733
+ infix 4 <.
1734
+ -- | The above type is a generalization for:
1735
+ --
1736
+ -- @
1737
+ -- __(<.)__ :: 'Ord' a => a -> 'Clash.Signal.Signal' a -> 'Clash.Signal.Signal' 'Bool'
1738
+ -- @
1739
+ --
1740
+ -- It is a version of ('<') that allows comparing a @'Clash.Signal.Signal' a@ with a constant
1741
+ -- @a@ and returns a 'Clash.Signal.Signal' of 'Bool'
1742
+ (<.) :: (Ord a , Functor f ) => a -> f a -> f Bool
1743
+ (<.) a b = fmap (a< ) b
1744
+
1745
+ infix 4 .<
1746
+ -- | The above type is a generalization for:
1747
+ --
1748
+ -- @
1749
+ -- __(.<)__ :: 'Ord' a => 'Clash.Signal.Signal' a -> a -> 'Clash.Signal.Signal' 'Bool'
1750
+ -- @
1751
+ --
1752
+ -- It is a version of ('<') that allows comparing a @'Clash.Signal.Signal' a@ with a constant
1753
+ -- @a@ and returns a 'Clash.Signal.Signal' of 'Bool'
1754
+ (.<) :: (Ord a , Functor f ) => f a -> a -> f Bool
1755
+ (.<) a b = fmap (< b) a
1756
+
1636
1757
infix 4 .<=.
1637
1758
-- | The above type is a generalization for:
1638
1759
--
@@ -1644,6 +1765,30 @@ infix 4 .<=.
1644
1765
(.<=.) :: (Ord a , Applicative f ) => f a -> f a -> f Bool
1645
1766
(.<=.) = liftA2 (<=)
1646
1767
1768
+ infix 4 .<=
1769
+ -- | The above type is a generalization for:
1770
+ --
1771
+ -- @
1772
+ -- __(.<=)__ :: 'Ord' a => 'Clash.Signal.Signal' a -> a -> 'Clash.Signal.Signal' 'Bool'
1773
+ -- @
1774
+ --
1775
+ -- It is a version of ('GHC.TypeNats.<=') that allows comparing a @'Clash.Signal.Signal' a@ with a constant
1776
+ -- @a@ and returns a 'Clash.Signal.Signal' of 'Bool'
1777
+ (.<=) :: (Ord a , Functor f ) => f a -> a -> f Bool
1778
+ (.<=) a b = fmap (<= b) a
1779
+
1780
+ infix 4 <=.
1781
+ -- | The above type is a generalization for:
1782
+ --
1783
+ -- @
1784
+ -- __(<=.)__ :: 'Ord' a => a -> 'Clash.Signal.Signal' a -> 'Clash.Signal.Signal' 'Bool'
1785
+ -- @
1786
+ --
1787
+ -- It is a version of ('GHC.TypeNats.<=') that allows comparing a @'Clash.Signal.Signal' a@ with a constant
1788
+ -- @a@ and returns a 'Clash.Signal.Signal' of 'Bool'
1789
+ (<=.) :: (Ord a , Functor f ) => a -> f a -> f Bool
1790
+ (<=.) a b = fmap (a<= )b
1791
+
1647
1792
infix 4 .>.
1648
1793
-- | The above type is a generalization for:
1649
1794
--
@@ -1655,6 +1800,30 @@ infix 4 .>.
1655
1800
(.>.) :: (Ord a , Applicative f ) => f a -> f a -> f Bool
1656
1801
(.>.) = liftA2 (>)
1657
1802
1803
+ infix 4 .>
1804
+ -- | The above type is a generalization for:
1805
+ --
1806
+ -- @
1807
+ -- __(.>)__ :: 'Ord' a => 'Clash.Signal.Signal' a -> a -> 'Clash.Signal.Signal' 'Bool'
1808
+ -- @
1809
+ --
1810
+ -- It is a version of ('>') that allows comparing a @'Clash.Signal.Signal' a@ with a constant
1811
+ -- @a@ and returns a 'Clash.Signal.Signal' of 'Bool'
1812
+ (.>) :: (Ord a , Functor f ) => f a -> a -> f Bool
1813
+ (.>) a b = fmap (> b) a
1814
+
1815
+ infix 4 >.
1816
+ -- | The above type is a generalization for:
1817
+ --
1818
+ -- @
1819
+ -- __(>.)__ :: 'Ord' a => a -> 'Clash.Signal.Signal' a -> 'Clash.Signal.Signal' 'Bool'
1820
+ -- @
1821
+ --
1822
+ -- It is a version of ('>') that allows comparing a @'Clash.Signal.Signal' a@ with a constant
1823
+ -- @a@ and returns a 'Clash.Signal.Signal' of 'Bool'
1824
+ (>.) :: (Ord a , Functor f ) => a -> f a -> f Bool
1825
+ (>.) a b = fmap (a> ) b
1826
+
1658
1827
infix 4 .>=.
1659
1828
-- | The above type is a generalization for:
1660
1829
--
@@ -1666,6 +1835,30 @@ infix 4 .>=.
1666
1835
(.>=.) :: (Ord a , Applicative f ) => f a -> f a -> f Bool
1667
1836
(.>=.) = liftA2 (>=)
1668
1837
1838
+ infix 4 .>=
1839
+ -- | The above type is a generalization for:
1840
+ --
1841
+ -- @
1842
+ -- __(.>=)__ :: 'Ord' a => 'Clash.Signal.Signal' a -> a -> 'Clash.Signal.Signal' 'Bool'
1843
+ -- @
1844
+ --
1845
+ -- It is a version of ('>=') that allows comparing a @'Clash.Signal.Signal' a@ with a constant
1846
+ -- @a@ and returns a 'Clash.Signal.Signal' of 'Bool'
1847
+ (.>=) :: (Ord a , Functor f ) => f a -> a -> f Bool
1848
+ (.>=) a b = fmap (>= b) a
1849
+
1850
+ infix 4 >=.
1851
+ -- | The above type is a generalization for:
1852
+ --
1853
+ -- @
1854
+ -- __(>=.)__ :: 'Ord' a => a -> 'Clash.Signal.Signal' a -> 'Clash.Signal.Signal' 'Bool'
1855
+ -- @
1856
+ --
1857
+ -- It is a version of ('>=') that allows comparing a @'Clash.Signal.Signal' a@ with a constant
1858
+ -- @a@ and returns a 'Clash.Signal.Signal' of 'Bool'
1859
+ (>=.) :: (Ord a , Functor f ) => a -> f a -> f Bool
1860
+ (>=.) a b = fmap (a>= ) b
1861
+
1669
1862
instance Fractional a => Fractional (Signal dom a ) where
1670
1863
(/) = liftA2 (/)
1671
1864
recip = fmap recip
0 commit comments