Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3320420
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:56:27+00:00 2026-05-17T22:56:27+00:00

I read the documentation and some articles that talk about the package, but I’m

  • 0

I read the documentation and some articles that talk about the package, but I’m new to Haskell and did not understand much but I tried ….

Below is what I did:

module Main where  
{-# LANGUAGE BangPatterns #-}   
import Control.Parallel(par,pseq)  
import Control.Exception  
import Data.List  
import IO  
import Data.Char  
import Criterion.Main (defaultMain, bench)  

learquivo :: FilePath -> IO ([[Int]])  
learquivo "mkList1.txt"  = do   
    conteudo <- readFile "mkList1.txt" 
    return (read conteudo) 


main = defaultMain [  
    bench "map sort learquivo" $ \n -> map sort learquivo
    ]

As it did the following error occurred:

Couldn't match expected type [[a]]
       against inferred type FilePath -> IO [[Int]]
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T22:56:28+00:00Added an answer on May 17, 2026 at 10:56 pm

    Just so you have how I usually run it, using the nf or whnf functions, I’ll give my code:

    import Data.List
    import Criterion.Main
    
    main :: IO ()
    main = do
       -- content <- learquivo "mkList1.txt"  
       let content = [ [big, big - step.. 0] | big <- [1000..1010], step <- [1..5]] :: [[Int]]
       defaultMain
            [ bench "benchmark-name" (nf (map sort) content)]
    

    EDIT: If you like this then also give plotting a try:

    module Main where
    
    import Data.List
    import Criterion.Main
    import Criterion.Config
    import Criterion.MultiMap as M
    
    main :: IO ()
    main = do
       let myConfig = defaultConfig {
                  -- Always display an 800x600 window with curves.
                  cfgPlot = M.singleton KernelDensity (Window 800 600)
                  }
       let content = [ [big, big-step.. 0] | big <- [1000..1010], step <- [1..5]] :: [[Int]]
       defaultMainWith myConfig (return ())
            [ bench "benchmark-name" (nf (map sort) content)]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have read the Apple documentation regarding Mobile Device Management (MDM) but did not
I read some documentation on sessionStorage and localStorage, but I don't understand what the
I've read some documentation and tutorials about developing Firefox Addons. But never found how
I've read some documentation on how Adaboost works but have some questions regarding it.
I am new to modernizr. I read some documentation on modernizr, and I wanted
I've read the documentation about __init__.py files and some nice questions here on SO,
While searching for some functions in C++ standard library documentation I read that push
I have read some of the basic Google Apps Script documentation/tutorials. I have not
I read some articles about HTTP headers compression. Today I installed YSlow and it
I have read some webpages and articles about llvm and I am quite interested

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.