Haskell Library for Checking CPU Information
traviswhitaker / cpuinfo Goto Github PK
View Code? Open in Web Editor NEWHaskell Library for Checking CPU Information
License: MIT License
Haskell Library for Checking CPU Information
License: MIT License
Hi, I need a module with physical cpus for both Linux and OS X, and I thought of adding it to cpuinfo, but I think the current API isn't going to work for anything other than linux. The reason is the CPU type has a million fields, many of them are linux-specific, and the useful functions like physicalCores
require CPUs.
What I would do is change functions like physicalCores to have type IO Int
. This is implemented as /usr/sbin/sysctl -n hw.physicalcpu
on OS X, and by parsing /proc/cpuinfo on linux. If they all throw the same NotSupported exception, we can have a try
which turns them into Maybe Int
if you don't want to crash on an unsupported platform.
Personally I'd just get rid of the CPU type because I don't have a use for all those fields, but I guess it doesn't hurt to have it, as long as it's clear that it's Linux-specific. Even use CPP to make it not compile on non-linux instead of compile but crash at runtime, but I don't care much either way.
Would you be interested in a change like that? It would be basically a rewrite and incompatible API. Otherwise I can make my own package easily enough, but it's a bit of a shame to have two similar packages in hackage. You could also transfer ownership to me if you'd like.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.