Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Haskell without types

Is it possible to disable or work around the type system in Haskell? There are situations where it is convenient to have everything untyped as in Forth and BCPL or monotyped as in Mathematica. I'm thinking along the lines of declaring everything as the same type or of disabling type checking altogether.

Edit: In conformance with SO principles, this is a narrow technical question, not a request for discussion of the relative merits of different programming approaches. To rephrase the question, "Can Haskell be used in a way such that avoidance of type conflicts is entirely the responsibility of the programmer?"

like image 386
user287424 Avatar asked May 25 '12 02:05

user287424


2 Answers

Also look at Data.Dynamic which allows you to have dynamically typed values in parts of your code without disabling type-checking throughout.

like image 151
Tikhon Jelvis Avatar answered Sep 21 '22 13:09

Tikhon Jelvis


GHC 7.6 (not released yet) has a similar feature, -fdefer-type-errors:

http://hackage.haskell.org/trac/ghc/wiki/DeferErrorsToRuntime

It will defer all type errors until runtime. It's not really untyped but it allows almost as much freedom.

like image 41
Pubby Avatar answered Sep 20 '22 13:09

Pubby