{- Testing script, generates all possible short hexadecimal strings. runhaskell integer-to-hex-tester.hs | runhaskell hex-to-integer.hs | runhaskell integer-to-hex.hs Copyright 2015 Ken Takusagawa This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . -} {-# LANGUAGE ScopedTypeVariables, LambdaCase #-} module Main(main) where { import Data.List; import Data.Char(intToDigit); main :: IO(); main = mapM_ putStrLn $ concatMap ndigit_hex [1..5]; hex_digits :: String; hex_digits = map intToDigit [0..15]; genericReplicateM :: (Monad m, Integral i) => i -> m a -> m [a]; genericReplicateM n = sequence . genericReplicate n; ndigit_hex :: Integer -> [String]; ndigit_hex n = genericReplicateM n hex_digits; } --end