Skip to content

Commit

Permalink
cleanup for #1437
Browse files Browse the repository at this point in the history
* add entry to CHANGES.md
* drop `deriving Generic` from `FinSeq` newtype
  • Loading branch information
danmatichuk committed Feb 20, 2025
1 parent a0ecfa8 commit 3829b63
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
# next -- TBA


## Language changes

## Bug fixes

* Fix #1437, enforce the VSeq invariant that it is not a sequence of bits.
Replaces the VSeq constructor with a view-only pattern, and smart constructors
`mkSeq` and `finSeq`.
([#1437](https://github.com/GaloisInc/cryptol/issues/1437))

* Fix #1740, removes duplicated width from word values.
Note that since this changes the types, it may require changes to libraries
depending on Cryptol.
Expand Down
5 changes: 2 additions & 3 deletions src/Cryptol/Eval/Value.hs
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,7 @@ ilam sym f =

-- | A finite sequence of non-VBit values. Used in 'finSeq' to
-- safely construct a 'VSeq'.
newtype FinSeq sym = FinSeq { fromFinSeq :: [GenValue sym] }
deriving Generic
newtype FinSeq sym = FinSeq [GenValue sym]

-- | Safely wrap a 'GenValue' list as a 'FinSeq'. Returns 'Nothing'
-- if any values are a 'VBit'.
Expand All @@ -412,7 +411,7 @@ toFinSeq xs = FinSeq <$> mapM go xs
_ -> Just x

-- | Wrap a 'GenValue' list as a 'FinSeq'. Raises a runtime
-- error if any values are a 'VBit'
-- error if any values are a 'VBit'.
unsafeToFinSeq :: [GenValue sym] -> FinSeq sym
unsafeToFinSeq xs = FinSeq (map go xs)
where
Expand Down

0 comments on commit 3829b63

Please # to comment.