haskell# Haskell Illegal term-level use of the type constructor 'Int'

I'm very new to Haskell and am trying to multiply a number by itself as followed:

```
Test :: Int -> Int
Test = Int * Int
```

Doing this gave me the following error ' Illegal term-level use of the type constructor ‘Int’' In the first argument of ‘(*)’, namely ‘Int’ In the expression: Int * Int In an equation for 'Test': Test = Int * Int

I'm pretty confused from this message. Can anyone explain what went wrong with this implementation?

Solution

`Int`

is a type, not a value or expression.

Also note that by convention, tokens starting with an uppercase denote a type, typeclass, or type constructor. For functions, you want to start with a lower case.

```
test :: Int -> Int
test n = n * n
```

If you're in need of a haskell resource, I strongly suggest reading Learn You a Haskell. It covers all these basics and more.

- Scotty: No instance for MonadIO ScottyT (arising from a use of ‘liftIO’)
- How can I implement a splay tree that performs the zig operation last, not first?
- Lack of Finite Element Method implementations in Haskell - Any specific reasons?
- What is fusion in Haskell?
- General approach for combining multiple foldrs over the accumulator type?
- using Lens for nested folds with a threaded accumulator
- What is the difference between . (dot) and $ (dollar sign)?
- understand haskell logic behind odd's and even's index lists
- Java tagged union / sum types
- Is indentation in Haskell like in Python?
- Unicode console I/O in Haskell on Windows
- Code formatting not working with Pandoc in Haskell
- How can I use `liftIO` with State to print values inside that Monad?
- Module X appears in multiple packages
- High order function returning result and modified itself
- Parsec not parsing newline character
- Enable -Woverflowed-literals for custom numeric types
- How to format UTCTime as ISO 8601 in Haskell
- Haskell Depth-First Graph Traversal has Infinite Loop
- Non-exhaustive patterns in function defined in GHCi
- How to run an individual test with Stack and Haskell Test.Framework?
- Persisting drawn frames in Gloss
- How do I convert from unixtime to a date/time in Haskell?
- Partially processing a conduit using another conduit
- State Monad - HASKELL
- How to load cabal script with import of hidden package in cabal repl?
- Applicative Functor - Haskell
- Haskells bind operator and the >> operator and their relation
- How to use forEach with multiple traversables?
- Telling Haskell compiler that two types are compatible