Q:

How to convert Date to days in Haskell?

So I have a problem... I have to write a programm for my college course where I count the exact number of days 
so for example
the date January 1st, 0001 will be 1
and the July 26nd, 2018 will be 736412
Beneath I tried to solve this problem, but no luck. Can you point me to my mistake?
type Date = (Int, Int, Int)

type Year = Int
type Month = Int
type Day = Int

datetoday :: Date -> Int
datetoday (year, month , day) = day + monthtoday month + yeartoday year

yeartoday :: year -> day
yeartoday year = ((year-1)*365)

monthtoday :: month -> day
monthtoday month
     |month 1 = 0
     |month 2 = 31
     |month 3 = 59
     |month 4 = 90
     |month 5 = 120
     |month 6 = 151
     |month 7 = 181
     |month 8 = 211
     |month 9 = 243
     |month 10 = 273
     |month 11 = 304
     |month 12 = 334

A:

There are two problems with your code:
yeartoday :: year -> day

year and day should be capitalised. If you don't, this is equivalent to a -> b, since uncapitalised identifiers are seen as type variables. This applies to your other signatures. So, this should be: 
yeartoday :: Year -> Day

And the same for the other signatures.
Here's the second problem.
monthtoday month
     |month 1 = 0
     |month 2 = 31
     (...)

The part where you write month 1, month 2 etc. expects a Bool, so you need to compare month and each value, so this should be:
monthtoday month
     |month == 1 = 0
     |month == 2 = 31
     (...)

But even better, you should rewrite this as:
monthtoday month = case month of
    1 -> 0
    2 -> 31
    (..)

There are other errors to do with correctness, and there are better ways of doing this, but I'll leave this to you since the issue here is to do with the type system.

