Data.Map的合格导入与Prelude冲突

时间:2016-06-01 03:38:39

标签: haskell import module compiler-errors

我想在我的代码中使用 policyTriggers - List<Trigger> - Required - Trigger setting for this policy, each trigger is defined as below metricType - String - Required - enumerated type for this trigger, for Java application, they are: JVMHeapUsage, Memory, Throughput, ResponseTime. For other app, only Memory is available. statWindow - int - Optional - interval to calculate statistics in seconds breachDuration - int - Optional - breach duration in seconds is divided by the periodicity of the metric to determine the number of data points that will result in a scaling event lowerThreshold - int - Optional - lower threshold that will trigger a scaling event, usually scaling-in, for JVMHeapUsage and Memory it's percentage, for Throughput, it's request per second and for ResponseTime, it's milliseconds upperThreshold - int - Optional - upper threshold that will trigger a scaling event, usually scaling-out. for JVMHeapUsage and Memory it's percentage, for Throughput, it's request per second and for ResponseTime, it's milliseconds instanceStepCountDown - int - Optional - number of instances to reduce per scaling-in action instanceStepCountUp - int - Optional - number of instances to increase per scaling-out action stepDownCoolDownSecs - int - Optional - cool down period that prevent further scaling in action stepUpCoolDownSecs - int - Optional - cool down period that prevent further scaling out action Prelude.map用于不同目的,但Data.Map.map的合格导入似乎没有帮助:

Data.Map

(我还收到了screenshot的错误消息which you can see here。)

我希望能够分别使用Prelude> import Data.Map as M Prelude M> map <interactive>:3:1: Ambiguous occurrence ‘map’ It could refer to either ‘M.map’ imported from ‘Data.Map’ (and originally defined in ‘containers-0.5.0.0:Data.Map.Base’) or ‘Prelude.map’ imported from ‘Prelude’ (and originally defined in ‘GHC.Base’) map;我怎么能这样做?

1 个答案:

答案 0 :(得分:9)

import qualified Data.Map as M 从Data.Map导入限定和非限定的名称。

要仅导入限定名称,请使用:

 $scope.saveData = function () {

 var resultData = new Object();
 resultData.Name = $scope.Name;
 resultData.Address = new Object();
 resultData.Address = $scope.Address;
 resultData.Address.Contact = $scope.Address.Contact;


     var promiseOrganization = AngularService.saveResult(resultData);

     promiseOrganization.then(function (result)
        {
            alert("Saved successfully.");
        }
    )
}