Habit system programming language

I’ve read “The Habit Programming Language: The Revised Preliminary Report” (2010):

http://hasp.cs.pdx.edu/habit-report-Nov2010.pdf

It’s another Haskell variant meant for system programming. Like Idris it fixes some Haskell design mistakes, but also adds lots of stuff for low level coding. I don’t think average C programmers will switch to a very Haskell-like language like this, but it shows some interesting (for me) ideas.

“Figure 1: Standard Habit Types” at page 16 shows that its reference types have optionally alignment too:

ARef l a    references to memory areas of type a with alignment l
Ref a       references with default alignment
APtr l a    pointers to memory areas of type a with alignment l
Ptr a       pointers with default alignment

This is like in Zig language:

https://andrewkelley.me/post/unsafe-zig-safer-than-unsafe-rust.html

Sometimes I miss that information in the Rust type system (and I used to miss it in the D language type system too).

“Figure 2: Standard Habit Type Classes” at page 19 and “Figure 3: Standard Habit Type Functions” at page 21 show that its integer generics are quite powerful (Rust constant generics will enjoy this power):

n <= m        type-level number comparison: n is less than or equal to m
n < m         type-level number comparison: n is less than m

n + m = p     p is the sum of n and m
n - m = p     p is the difference of n and m
n * m = p     p is the product of n and m
n / m = p     p is the result of dividing n by m, with no remainder
n ^ m = p     p is the result of raising n to the power m
GCD n m = p   p is the greatest common divisor of n and m

Figure 2 also shows the handling of memory initialization:

Initable a    areas of type a have a default initializer
NoInit a      areas of type a do not require initialization
NullInit a    areas of type a can be null-initialized
2 Likes

Rust is now a long-enough lived project that this kind of forgetting is common, but Mozilla hired early Rust developer Tim Chevalier out of the HASP group, where he formerly worked on Habit.

7 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.