Ticket #419 (new bug)
Haskell2Isabelle: treatment of (non-)strict datatypes and newtypes
| Reported by: | till | Owned by: | paolot |
|---|---|---|---|
| Priority: | normal | Milestone: | 0.95 |
| Component: | comorphisms | Version: | 0.73 |
| Keywords: | Cc: |
Description (last modified by till) (diff)
As explained in the Haskell report, section 4.2.3, the following four Haskell declarations
data D1 = D1 Int data D2 = D2 !Int type S = Int newtype N = N Int
have four different semantics. Indeed, the correct translation to Isabelle is as follows:
domain D1 = D1 (lazy D1_1::"dInt")
domain D2 = D2 (D2_1::"dInt")
types S = "dInt"
pcpodef N = "{x:: dInt . True}"
by auto
The "constructor" for N is Abs_N, the selector Rep_N. Patterns involving the constructor N must be translated to variables. The encapsulated value can be obtained by applying the selector (Rep_N) to the variable. The complete example and the correct translation is attached.
Attachments
Change History
Note: See
TracTickets for help on using
tickets.