Python, Java, C++, Haskell, ... are *general purpose languages*. They
are designed to be generally applicable to many different
computational problems.
A *domain specific language* (DSL) is one that is designed to be
applied to solving problems, or describing computations, in a narrow
domain.
Sometimes, DSLs can be *embedded* in a "host language". That is, the
embedded DSL (EDSL) is really "just" a library in the host language.
Whether a library can be thought of as an EDSL comes down to the way
the library is designed:
1. What are the different types of values that the language can
work with?
2. It should be compositional: simpler values can be combined
to build up more complicated ones.
> {-# LANGUAGE GADTSyntax #-}
>
> import Prelude hiding ((<$>), (<$), (<*>), (<*), (*>))
> import Parsing
>
> lexer :: TokenParser u
> lexer = makeTokenParser emptyDef
>
> parens :: Parser a -> Parser a
> parens = getParens lexer
>
> reservedOp :: String -> Parser ()
> reservedOp = getReservedOp lexer
>
> integer :: Parser Integer
> integer = getInteger lexer
>
> whiteSpace :: Parser ()
> whiteSpace = getWhiteSpace lexer
-- data Either a b where
-- Left :: a -> Either a b
-- Right :: b -> Either a b
> f :: Integer -> [Integer]
> f n = [n,n+1,n+2]