1
votes

Reading through Numeric.LinearProgramming I am confused by the type declaration

data Bound x =   x :<=: Double 
               | x :>=: Double
               | x :&: (Double, Double)
               | x :==: Double
               | Free x 
                   deriving Show

Suppose we input Int in place of x. Then a member of type Bound Int would be something like Int :&: (1.2345 :: Double). But Int is a type, and presumably not a valid name/identifier for a data constructor. What's going on here?

1

1 Answers

2
votes

In this example, x is not the data constructor, rather :&:, :<=:, :>=:, :==:, and Free. Apart from Free, these are all infix data constructors. The best-known example is the list 'append' operator, :.