Ticket #419 (new bug)

Opened 3 years ago

Last modified 3 years ago

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

types.hs (153 bytes) - added by till 3 years ago.
Haskell source from Haskell report, section 4.2.3
types_hc.thy (1.4 kB) - added by till 3 years ago.
intended translation to Isabelle/HOLCF

Change History

Changed 3 years ago by till

Haskell source from Haskell report, section 4.2.3

Changed 3 years ago by till

intended translation to Isabelle/HOLCF

Changed 3 years ago by till

  • description modified (diff)
Note: See TracTickets for help on using tickets.