Skip to content

Commit acd871f

Browse files
authored
Merge pull request #2601 from clash-lang/random-stuff13
Various small fixes - part 13
2 parents 1c373ef + 65b8602 commit acd871f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+213
-224
lines changed

STYLE.rst

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ space. Some examples:
4545
where
4646
greeting name = "Hello, " ++ name ++ "!"
4747
48-
filter
49-
:: (a -> Bool)
50-
-> [a]
48+
filter
49+
:: (a -> Bool)
50+
-> [a]
5151
-> [a]
5252
filter _ [] = []
5353
filter p (x:xs)
@@ -86,11 +86,11 @@ instead. An example of a multiline tuple declaration is:
8686
( a
8787
, b
8888
, c )
89-
90-
goodMulti2 =
89+
90+
goodMulti2 =
9191
( a
9292
, b
93-
, c
93+
, c
9494
)
9595
9696
Use nested tuples as such:
@@ -114,7 +114,7 @@ multiple constructors, each constructor will get its own line. Example:
114114

115115
.. code:: haskell
116116
117-
data Tree a
117+
data Tree a
118118
= Branch !a !(Tree a) !(Tree a)
119119
| Leaf
120120
deriving (Eq, Show)
@@ -123,12 +123,12 @@ Data types deriving lots of instances may be written like:
123123

124124
.. code:: haskell
125125
126-
data Tree a
126+
data Tree a
127127
= Branch !a !(Tree a) !(Tree a)
128128
| Leaf
129129
deriving
130130
( Eq, Show, Ord, Read, Functor, Generic, NFData
131-
, Undefined, BitPack, ShowX)
131+
, NFDataX, BitPack, ShowX)
132132
133133
Data types with a single constructor may be written on a single line:
134134

@@ -141,11 +141,11 @@ Format records as follows:
141141
.. code:: haskell
142142
143143
data Person = Person
144-
{ firstName :: !String
144+
{ firstName :: !String
145145
-- ^ First name
146-
, lastName :: !String
146+
, lastName :: !String
147147
-- ^ Last name
148-
, age :: !Int
148+
, age :: !Int
149149
-- ^ Age
150150
} deriving (Eq, Show)
151151
@@ -168,7 +168,7 @@ You may put the closing bracket on a new line. Use your judgement.
168168
exceptions =
169169
[ InvalidStatusCode
170170
, MissingContentHeader
171-
, InternalServerError
171+
, InternalServerError
172172
]
173173
174174
You may not skip the first newline.
@@ -179,7 +179,7 @@ You may not skip the first newline.
179179
directions = [ North
180180
, East
181181
, South
182-
, West
182+
, West
183183
]
184184
185185
*unless* it fits on a single line:
@@ -212,8 +212,8 @@ Or:
212212

213213
.. code:: haskell
214214
215-
exceptions =
216-
North :> East :> South
215+
exceptions =
216+
North :> East :> South
217217
:> West :> Middle :> Nil
218218
219219
Language pragmas
@@ -257,13 +257,13 @@ your judgement. Some examples:
257257
.. code:: haskell
258258
259259
bar :: IO ()
260-
bar =
260+
bar =
261261
forM_ [1, 2, 3] $ \n -> do
262262
putStrLn "Here comes a number!"
263263
print n
264264
265265
foo :: IO ()
266-
foo =
266+
foo =
267267
alloca 10 $ \a ->
268268
alloca 20 $ \b ->
269269
cFunction a b
@@ -299,17 +299,17 @@ like you would normal expressions:
299299

300300
.. code:: haskell
301301
302-
foo =
303-
if cond0 then
302+
foo =
303+
if cond0 then
304304
...
305-
else
305+
else
306306
...
307307
308308
When used in monadic contexts, use:
309309

310310
.. code:: haskell
311311
312-
foo =
312+
foo =
313313
if cond0 then do
314314
...
315315
else do
@@ -337,7 +337,7 @@ the two following styles:
337337

338338
.. code:: haskell
339339
340-
foobar =
340+
foobar =
341341
case something of
342342
Just j -> foo
343343
Nothing -> bar
@@ -346,18 +346,18 @@ or as
346346

347347
.. code:: haskell
348348
349-
foobar =
349+
foobar =
350350
case something of
351-
Just j ->
351+
Just j ->
352352
foo
353-
Nothing ->
353+
Nothing ->
354354
bar
355355
356356
In monadic contexts, use:
357357

358358
.. code:: haskell
359359
360-
foobar =
360+
foobar =
361361
case something of
362362
Just j -> do
363363
foo
@@ -383,7 +383,7 @@ Longer ones should be put on multiple lines:
383383

384384
.. code:: haskell
385385
386-
toInt
386+
toInt
387387
:: Int
388388
-- ^ Shift char by /n/
389389
-> Char
@@ -394,7 +394,7 @@ Multiple constraints can be added with a "tuple":
394394

395395
.. code:: haskell
396396
397-
toInt
397+
toInt
398398
:: (Num a, Show a)
399399
=> a
400400
-- ^ Shift char by /n/
@@ -406,7 +406,7 @@ Many constraints need to be split accross multiple lines too:
406406

407407
.. code:: haskell
408408
409-
toInt
409+
toInt
410410
:: ( Num a
411411
, Show a
412412
, Foo a
@@ -423,7 +423,7 @@ Many constraints need to be split accross multiple lines too:
423423

424424
.. code:: haskell
425425
426-
toInt
426+
toInt
427427
:: forall a
428428
. (Num a , Show a)
429429
=> a
@@ -443,13 +443,13 @@ your function would end up looking like:
443443
resetDomain
444444
resetKind
445445
domainGatedness
446-
. ( Undefined a
446+
. ( NFDataX a
447447
, Ord b
448448
, NFData c
449449
, Functor f )
450450
=> f a
451451
-> f b
452-
-> f c
452+
-> f c
453453
454454
Imports
455455
-------
@@ -499,12 +499,12 @@ every exported data type. Function example:
499499
-- | Send a message on a socket. The socket must be in a connected
500500
-- state. Returns the number of bytes sent. Applications are
501501
-- responsible for ensuring that all data has been sent.
502-
send
502+
send
503503
:: Socket
504504
-- ^ Connected socket
505-
-> ByteString
505+
-> ByteString
506506
-- ^ Data to send
507-
-> IO Int
507+
-> IO Int
508508
-- ^ Bytes sent
509509
510510
For functions the documentation should give enough information apply the
@@ -516,9 +516,9 @@ Record example:
516516
517517
-- | Bla bla bla.
518518
data Person = Person
519-
{ age :: !Int
519+
{ age :: !Int
520520
-- ^ Age
521-
, name :: !String
521+
, name :: !String
522522
-- ^ First name
523523
}
524524
@@ -544,7 +544,7 @@ comments for data type definitions. Some examples:
544544

545545
.. code:: haskell
546546
547-
data Parser =
547+
data Parser =
548548
Parser
549549
!Int -- Current position
550550
!ByteString -- Remaining input
@@ -603,8 +603,8 @@ spend thinking about evaluation order.
603603
604604
-- Good
605605
data Point = Point
606-
{ pointX :: !Double
607-
, pointY :: !Double
606+
{ pointX :: !Double
607+
, pointY :: !Double
608608
}
609609
610610
.. code:: haskell

clash-cores/src/Clash/Cores/Xilinx/VIO.hs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,12 @@ vioProbe ::
111111
a
112112
vioProbe inputNames outputNames initialOutputProbeValues clk =
113113
vioProbe# @dom @a @o inputNames outputNames initialOutputProbeValues clk
114-
{-# CLASH_OPAQUE vioProbe #-}
115-
116-
-- | Primitive for 'vioProbe'. Defining a wrapper like this makes the VIO probe
114+
-- Defining a NOINLINEd wrapper like this makes the 'vioProbe#'
117115
-- instantiation be rendered in its own module to reduce naming collision
118116
-- probabilities.
117+
{-# CLASH_OPAQUE vioProbe #-}
118+
119+
-- | Primitive for 'vioProbe'.
119120
vioProbe# ::
120121
forall dom a o n m.
121122
(KnownDomain dom, VIO dom a o) =>

clash-cosim/src/Clash/CoSim/CodeGeneration.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ coSimTypeGen clks args = do
116116
let domName = mkName "dom"
117117
let dom = return $ VarT domName
118118

119-
-- Generate contraints:
119+
-- Generate constraints:
120120
argConstraints <- sequence $ map (\name -> [t| ClashType $name |]) argTypeNames
121121
resConstraint <- [t| ClashType $result |]
122122
kdConstraint <- [t| KnownDomain $dom |]

clash-ghc/src-bin-881/Clash/GHCi/UI.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3202,9 +3202,9 @@ implemented above.
32023202
The same filter was also implemented to fix Trac #11051 [3]. See the
32033203
Note [What to show to users] in compiler/main/InteractiveEval.hs
32043204
3205-
[1] https://ghc.haskell.org/trac/ghc/ticket/12525
3206-
[2] https://ghc.haskell.org/trac/ghc/ticket/12525#comment:1
3207-
[3] https://ghc.haskell.org/trac/ghc/ticket/11051
3205+
[1] https://gitlab.haskell.org/ghc/ghc/-/issues/12525
3206+
[2] https://gitlab.haskell.org/ghc/ghc/-/issues/12525#comment:1
3207+
[3] https://gitlab.haskell.org/ghc/ghc/-/issues/11051
32083208
-}
32093209

32103210

clash-lib/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ low-level synthesizable VHDL, Verilog, or SystemVerilog.
1010

1111
Features of Clash:
1212

13-
* Strongly typed (like VHDL), yet with a very high degree of type inference,
14-
enabling both safe and fast prototying using consise descriptions (like
15-
Verilog).
13+
* Strongly typed, but with a very high degree of type inference, enabling both
14+
safe and fast prototyping using concise descriptions.
1615

1716
* Interactive REPL: load your designs in an interpreter and easily test all
1817
your component without needing to setup a test bench.

clash-lib/prims/common/Clash_XException.primitives.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222
- BlackBox:
2323
name: Clash.XException.deepseqX
2424
kind: Expression
25-
type: 'deepseqX :: Undefined
26-
a => a -> b -> b'
25+
type: 'deepseqX :: NFDataX a => a -> b -> b'
2726
template: ~ARG[2]
2827
workInfo: Never
2928
- BlackBox:

clash-lib/prims/systemverilog/Clash_Explicit_BlockRam.primitives.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
blockRam#
66
:: ( KnownDomain dom ARG[0]
77
, HasCallStack -- ARG[1]
8-
, Undefined a ) -- ARG[2]
8+
, NFDataX a ) -- ARG[2]
99
=> Clock dom -- clk, ARG[3]
1010
-> Enable dom -- en, ARG[4]
1111
-> Vec n a -- init, ARG[5]
@@ -50,7 +50,7 @@
5050
blockRamU#
5151
:: ( KnownDomain dom ARG[0]
5252
, HasCallStack -- ARG[1]
53-
, Undefined a ) -- ARG[2]
53+
, NFDataX a ) -- ARG[2]
5454
=> Clock dom -- clk, ARG[3]
5555
-> Enable dom -- en, ARG[4]
5656
-> SNat n -- len, ARG[5]
@@ -92,7 +92,7 @@
9292
blockRam1#
9393
:: ( KnownDomain dom ARG[0]
9494
, HasCallStack -- ARG[1]
95-
, Undefined a ) -- ARG[2]
95+
, NFDataX a ) -- ARG[2]
9696
=> Clock dom -- clk, ARG[3]
9797
-> Enable dom -- en, ARG[4]
9898
-> SNat n -- len, ARG[5]

clash-lib/prims/systemverilog/Clash_Explicit_DDR.primitives.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
type: |-
55
ddrIn# :: forall a slow fast n pFast gated synchronous.
66
( HasCallStack -- ARG[0]
7-
, Undefined a -- ARG[1]
7+
, NFDataX a -- ARG[1]
88
, KnownConfi~ fast domf -- ARG[2]
99
, KnownConfi~ slow doms -- ARG[3]
1010
=> Clock slow -- ARG[4], clk
@@ -49,8 +49,8 @@
4949
kind: Declaration
5050
outputUsage: Blocking
5151
type: |-
52-
ddrOut# :: ( HasCallStack -- ARG[0]
53-
, Undefined a -- ARG[1]
52+
ddrOut# :: ( HasCallStack -- ARG[0]
53+
, NFDataX a -- ARG[1]
5454
, KnownConfi~ fast domf -- ARG[2]
5555
, KnownConfi~ slow doms -- ARG[3]
5656
=> Clock slow -- ARG[4]

clash-lib/prims/systemverilog/Clash_Explicit_ROM.primitives.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
type: |-
55
rom# :: ( KnownDomain dom ARG[0]
66
, KnownNat n -- ARG[1]
7-
, Undefined a ) -- ARG[2]
7+
, NFDataX a ) -- ARG[2]
88
=> Clock dom -- clk, ARG[3]
99
=> Enable dom -- en, ARG[4]
1010
-> Vec n a -- init, ARG[5]

clash-lib/prims/systemverilog/Clash_Signal_Internal.primitives.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
type: |-
66
delay#
77
:: ( KnownDomain dom -- ARG[0]
8-
, Undefined a ) -- ARG[1]
8+
, NFDataX a ) -- ARG[1]
99
=> Clock dom -- ARG[2]
1010
-> Enable dom -- ARG[3]
1111
-> a -- ARG[4]
@@ -62,7 +62,7 @@
6262
type: |-
6363
register#
6464
:: ( KnownDomain dom -- ARG[0]
65-
, Undefined a ) -- ARG[1]
65+
, NFDataX a ) -- ARG[1]
6666
=> Clock dom -- ARG[2]
6767
-> Reset dom -- ARG[3]
6868
-> Enable dom -- ARG[4]

0 commit comments

Comments
 (0)