How to program in a type system that mismatches Haskell's System-Fw?

MaiaVictor

I'm studying optimal implementations of the λ-calculus. There is a particular subset of lambda terms that is very efficient. It corresponds to the type system of Elementary Affine Logic with fixed points. In order to test my implementations of that algorithm, I have to write moderately complex terms on that system. This is difficult without a infrastructure. I have to use the untyped lambda calculus and then manually add the types; no checking, unification, no type errors.

One idea would be to write programs in Haskell - taking benefit from its mature type-checker - and then translate to EAL. Unfortunately, there is a mismatch between System-Fw and EAL. For example, you can't express Scott-encoded ADTs in Haskell without newtype, due to the lack of a type-level fix. Moreover, Haskell is a complex language, and writing a Haskell->EAl compiler would not be trivial.

Is there any quick/dirty way to get a working type checker/inferencer/unifier for that system - or at least something close enough - without having to program it all myself?

Derek Elkins left SE

Probably the quickest and easiest way is to embed your system into Haskell as an EDSL. The finally, tagless approach may be ideal and there's an example of encoding a linear type system with it. In particular, I'd recommend using the HOAS variation by Jeff Polakow. This will give you syntax like:

*Main> :t eval $ llam $ \x -> add x (int 1)
eval $ llam $ \x -> add x (int 1) :: Int -<> Int

which isn't too terrible. One aspect of the finally, tagless approach is that you can can have multiple interpretations for the same term, so you can have an interpretation that translates the term to some AST representing EAL, or have an interpretation that performs some additional typechecking if you aren't able to capture all of it in Haskell's type system.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Type System in Haskell

From Dev

Haskell type system explanation?

From Dev

Is Haskell's purity enforced by the type system or IO's implementation?

From Java

Does Haskell's type system honor the Liskov Substitution Principle?

From Dev

How can I improve my understanding of the Haskell Type system?

From Dev

What is the difference in capability between the SML module system and Haskell's Type and Typeclass system?

From Dev

Intuit QBO SDK Update Bill error generating the XML document Value of ItemElementName mismatches the type of System.Decimal

From Dev

Type system differences between Haskell and ML

From Dev

Understanding the Haskell type system in the context of applicatives

From Dev

What does `Num a => a` mean in Haskell type system?

From Dev

How does Scala's type system compare to Java's?

From Dev

How is this Perl sensical, considering Perl 6's type system?

From Dev

How to work around F#'s type system

From Dev

How to work around F#'s type system

From Dev

What is the `[` program that resides in my system's /bin?

From Dev

How to implement search in file system in haskell?

From Dev

How to change the default program for a chosen file type system-wide in kde or xfce?

From Java

How to run a program without an operating system?

From Dev

How to terminate a system process in C++ program?

From Dev

How to terminate a system process in C++ program?

From Dev

Haskell: Specifying equal-length constraints of lists in the type system

From Dev

The nature of Haskell type system: static/dynamic, manual/inferred?

From Dev

How to determine the block size used by the file system by using a C program that performs incremental read()'s?

From Dev

What is formally the name of SML's type system?

From Dev

What is formally the name of SML's type system?

From Dev

Why is the type system refusing my seemingly valid program?

From Dev

default mime type program is inconsistent between system and the mozilla firefox/thunderbird?

From Dev

Scala type system, constrain member's type by parameter of own type

From Dev

What qualifies as a system program?

Related Related

  1. 1

    Type System in Haskell

  2. 2

    Haskell type system explanation?

  3. 3

    Is Haskell's purity enforced by the type system or IO's implementation?

  4. 4

    Does Haskell's type system honor the Liskov Substitution Principle?

  5. 5

    How can I improve my understanding of the Haskell Type system?

  6. 6

    What is the difference in capability between the SML module system and Haskell's Type and Typeclass system?

  7. 7

    Intuit QBO SDK Update Bill error generating the XML document Value of ItemElementName mismatches the type of System.Decimal

  8. 8

    Type system differences between Haskell and ML

  9. 9

    Understanding the Haskell type system in the context of applicatives

  10. 10

    What does `Num a => a` mean in Haskell type system?

  11. 11

    How does Scala's type system compare to Java's?

  12. 12

    How is this Perl sensical, considering Perl 6's type system?

  13. 13

    How to work around F#'s type system

  14. 14

    How to work around F#'s type system

  15. 15

    What is the `[` program that resides in my system's /bin?

  16. 16

    How to implement search in file system in haskell?

  17. 17

    How to change the default program for a chosen file type system-wide in kde or xfce?

  18. 18

    How to run a program without an operating system?

  19. 19

    How to terminate a system process in C++ program?

  20. 20

    How to terminate a system process in C++ program?

  21. 21

    Haskell: Specifying equal-length constraints of lists in the type system

  22. 22

    The nature of Haskell type system: static/dynamic, manual/inferred?

  23. 23

    How to determine the block size used by the file system by using a C program that performs incremental read()'s?

  24. 24

    What is formally the name of SML's type system?

  25. 25

    What is formally the name of SML's type system?

  26. 26

    Why is the type system refusing my seemingly valid program?

  27. 27

    default mime type program is inconsistent between system and the mozilla firefox/thunderbird?

  28. 28

    Scala type system, constrain member's type by parameter of own type

  29. 29

    What qualifies as a system program?

HotTag

Archive