The most interesting are probably the static checks that can be done with Type arithmetic,
that enforce the number of bands at compile time, rather than runtime, by
lifting the band count into the type level.
Smart constructors - HaskellWiki - 0 views
-
-
typecheck perform the check statically, using phantom types and Peano numbers.
-
So encode a type-level version of the bounds check. Only resistors with bands >= 4 and <= 8 are valid:
- ...1 more annotation...
Purely Functional Algorithm Specification ~ Jan van Eijck - 0 views
-
This course offers a perspective on algorithm specification, in terms of purely functional programming. An algorithm is an effective method expressed as a list of instructions describing a computation for calculating a result. Algorithms have to be written in human readable form, either using pseudocode (natural language looking like executable code), a high level specification language like Dijkstra's Guarded Command Language, or an executable formal specification formalism such as Z. The course will develop a purely functional perspective on algorithm specification, and demonstrate how this can be used for specifying (executable) algorithms, and for automated testing of Hoare correctness statements about these algorithms. The small extension of Haskell that we will present and discuss can be viewed as a domain specific language for algorithm specification and testing. Inspiration for this was the talk by Leslie Lamport at CWI on the executable algorithm specification language PlusCal plus Edsger W. Dijkstra, "EWD472: Guarded commands, non-determinacy and formal derivation of programs." Instead of formal program derivation, we demonstrate test automation of Hoare style assertions.
Understanding Monads Via Python List Comprehensions « All Unkept - 0 views
-
But here we have taken it to a higher level -- the Monad interface is like an abstraction of any kind of container.
-
This in turn leads to the concept that a monadic value represents a computation -- a method for computing a value, bound together with its input value.
-
Writing monads is hard, but it pays off as using them in Haskell is surprisingly easy, and allows you to do some very powerful things.
- ...3 more annotations...
Understanding Haskell Monads - 0 views
-
The opposite of referentially transparent is referentially opaque. A referentially opaque function is a function that may mean different things and return different results each time, even if all arguments are the same.
-
a function that just prints a fixed text to the screen and always returns 0, is referentially opaque, because you cannot replace the function call with 0 without changing the meaning of the program.
-
n fact, a function, which doesn't take any arguments, isn't even a function in Haskell. It's simply a value. A number of simple solutions to this problem exist. One is to expect a state value as an argument and produce a new state value together with a pseudorandom number: random :: RandomState -> (Int, RandomState)
- ...12 more annotations...
1 - 5 of 5
Showing 20▼ items per page