{- | This is the fourth assignment for IB016, semester spring 2016. Name: Name Surname UID: 123456 Extra packages used: none == Jdem.cz stats visualization Your task is to implement a program producing simple histogram vizualizations based on the data obtainted from the network API of an existing URL shortening service. is a Czeck URL shortening service providing a set of additional options. We will be interested in using its to obtain access count for the particular URL with regard to the domain the access originatted from. From the data, draw a simple ASCII-based histogram such as the one below. @ Short URL: http://jdem.cz/h9rg7 Original URL: http://zdrojak.root.cz/clanky/ukazte-se-jake-nastroje-pouzivate/ Access statistics: domena1.cz | 160 | ******************* dom2.cz | 200 | ************************ domena1.com | 146 | *************** domena2.net | 105 | *********** domena3.org | 91 | ********* domena4.com | 99 | ********** d5.cz | 101 | ********** domena6.com | 120 | ************** domena7.com | 11 | * @ === Program input processing * The program requires inputting an URL shorened by jdem.cz service. This is input as a CLI argument. * In case of multiple arguments, each is interpreted and processed separately. * If the argument is not a valid URL shortened by jdem.cz or there are no arguments at all, an error message is printed to the standard error output instead of visit histogram. === Output specification * The output starts by printing the short URL followed by the original URL that was shortened. * Next follows a part with domain-number-bar combination for every domain from which the shortened URL was accessed. The number is the aggregate of visit counts for the particular domain. The bar length corresponds to the number, forming a visit count histogram * The numbers should be shown for level 2 domains (that is, for example fi.muni.cz and sci.muni.cz are both hidden under muni.cz) * If not implementing the bonus (see below), the histogram part should have a fixed width no shorter than 20 and lo longer than 100 characters. * The histogram has to be normalized for the chosen width (i.e. the longest bar spans the whole width). * The histogram bars should be justified (i.e. start in the same column). Domains can be justified to the left or right. Numbers should be justified to the right. * If not stated above as a requirement, small devitions from the shown output will be tolerated (e.g. different words in the header, different symbols as separators, ...). Use your personal taste to style the output if you feel like it :-\}. === Further notes * Use proper types -- e.g. network addresses should be stored as 'Network.URI.URI' not as 'String'. * You are free to use any package from Hackage supported by the compiler version used as reference this semester. However, any extra packages must (!) be stated in the header. * You can get bonus points for adjusting the histogram size to the current screen size (e.g. by using the ). * When testing your solutions, please don't overload the servers of the service provider. === Tips and tricks * The implements a neat JSON manipulation library (but you are free to use any other, for example the very simple to use ). * When importing functions, it is recommended to make all imports explicit by naming all the imported functions (importing the whole module is generally discouraged). * You can test your implementation on these links: , , , , , , -} module Main ( main ) where -- | The entry of your program. -- Interprets the CLI arguments as a shortened URLs and prints -- the histogram of accesses from different domains for each. -- In case of no or invalid arguments, an error message is printed. main :: IO () main = undefined