Skip to content

Commit 9e2e423

Browse files
[skip ci] Update state of GADT support
1 parent 324b179 commit 9e2e423

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

clash-prelude/src/Clash/Tutorial.hs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2125,12 +2125,20 @@ Here is a list of Haskell features for which the Clash compiler has only
21252125
For \"easy\" 'Vec'tor literals you should use Template Haskell splices and
21262126
the 'listToVecTH' /meta/-function that as we have seen earlier in this tutorial.
21272127
2128-
* __GADT pattern matching__
2128+
* __GADTs__
21292129
2130-
While pattern matching for regular ADTs is supported, pattern matching for
2131-
GADTs is __not__. The constructors 'Cons' and 'Nil' of the 'Vec'tor type,
2132-
which is also a GADT, are __no__ exception! However, you can use the
2133-
convenient ':>' pattern synonym.
2130+
Clash has experimental support for GADTs. Similar to recursive types, Clash
2131+
can't determine bit-sizes of GADTs. Notable exceptions to this rule are
2132+
'Vec' and 'RTree'. You can still use your own GADTs, as long as they can be
2133+
removed through static analysis. For example, the following case will be
2134+
optimized away and is therefore fine to use:
2135+
2136+
@
2137+
x =
2138+
case 'resetKind' @@'System' of
2139+
SAsynchronous -> 'a'
2140+
SSynchronous -> 'b'
2141+
@
21342142
21352143
* __Floating point types__
21362144

0 commit comments

Comments
 (0)